Gallery › App Service › Azure built-in policies
Function apps should provide an auto-generated domain name label scope
Converted Policy Audit Deny Disabled Mode Indexed Version 1.1.0
Providing an auto-generated domain name label scope for your app ensures that the app can be accessed via a unique URL. For more information, see https://aka.ms/app-service-autoGeneratedDomainNameLabelScope.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONFunctionApp_Audit_AutoGeneratedDomainNameLabelScope.json · 67 lines
{
"properties": {
"displayName": "Function apps should provide an auto-generated domain name label scope",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Providing an auto-generated domain name label scope for your app ensures that the app can be accessed via a unique URL. For more information, see https://aka.ms/app-service-autoGeneratedDomainNameLabelScope.",
"version": "1.1.0",
"metadata": {
"version": "1.1.0",
"category": "App Service"
},
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Disabled",
"Deny"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Web/sites"
},
{
"field": "kind",
"contains": "functionapp"
},
{
"field": "kind",
"notContains": "workflowapp"
},
{
"field": "kind",
"notContains": "azurecontainerapps"
},
{
"field": "Microsoft.Web/sites/sku",
"notContains": "Isolated"
},
{
"field": "Microsoft.Web/sites/autoGeneratedDomainNameLabelScope",
"exists": "false"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.1.0",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/5f78d1de-663e-4a6b-8dd8-791621f3b6d6",
"name": "5f78d1de-663e-4a6b-8dd8-791621f3b6d6"
}Bylaw5f78d1de-663e-4a6b-8dd8-791621f3b6d6.bylaw.ps1 · 35 lines
# Converted from FunctionApp_Audit_AutoGeneratedDomainNameLabelScope.json by ConvertTo-Bylaw.
Policy '5f78d1de-663e-4a6b-8dd8-791621f3b6d6' {
Properties @{
DisplayName = 'Function apps should provide an auto-generated domain name label scope'
Description = 'Providing an auto-generated domain name label scope for your app ensures that the app can be accessed via a unique URL. For more information, see https://aka.ms/app-service-autoGeneratedDomainNameLabelScope.'
Version = '1.1.0'
Category = 'App Service'
PolicyVersion = '1.1.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled', 'Deny')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Web/sites' {
When {
Field kind | Must -ContainText 'functionapp'
Field kind | Must -Not -ContainText 'workflowapp'
Field kind | Must -Not -ContainText 'azurecontainerapps'
Field sku | Must -Not -ContainText 'Isolated'
}
Require 'autoGeneratedDomainNameLabelScope exists' {
Field autoGeneratedDomainNameLabelScope | Must -Exist
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/App Service/FunctionApp_Audit_AutoGeneratedDomainNameLabelScope.json in Azure/azure-policy, under the MIT licence.
Bylaw