Gallery › App Service › Azure built-in policies
App Service apps should use private link
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.1
Azure Private Link lets you connect your virtual networks to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to App Service, you can reduce data leakage risks. Learn more about private links at: https://aka.ms/private-link.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONPrivateEndpoint_AINE.json · 48 lines
{
"properties": {
"displayName": "App Service apps should use private link",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Azure Private Link lets you connect your virtual networks to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to App Service, you can reduce data leakage risks. Learn more about private links at: https://aka.ms/private-link.",
"metadata": {
"version": "1.0.1",
"category": "App Service"
},
"version": "1.0.1",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "AuditIfNotExists"
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Web/sites"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Web/sites/privateEndpointConnections",
"existenceCondition": {
"field": "Microsoft.Web/sites/privateEndpointConnections/privateLinkServiceConnectionState.status",
"equals": "Approved"
}
}
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/687aa49d-0982-40f8-bf6b-66d1da97a04b",
"name": "687aa49d-0982-40f8-bf6b-66d1da97a04b"
}Bylaw687aa49d-0982-40f8-bf6b-66d1da97a04b.bylaw.ps1 · 27 lines
# Converted from PrivateEndpoint_AINE.json by ConvertTo-Bylaw.
Policy '687aa49d-0982-40f8-bf6b-66d1da97a04b' {
Properties @{
DisplayName = 'App Service apps should use private link'
Description = 'Azure Private Link lets you connect your virtual networks to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to App Service, you can reduce data leakage risks. Learn more about private links at: https://aka.ms/private-link.'
Version = '1.0.1'
Category = 'App Service'
PolicyVersion = '1.0.1'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Web/sites'
AuditIfNotExists 'Microsoft.Web/sites/privateEndpointConnections' -Effect (Param Effect) {
Require 'privateLinkServiceConnectionState.status is Approved' {
Field privateLinkServiceConnectionState.status | Must -Be 'Approved'
}
}
}Source: built-in-policies/policyDefinitions/App Service/PrivateEndpoint_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw