Gallery › App Service › Azure Landing Zones Library
Enforce recommended guardrails for App Service
Converted Initiative Version 1.1.0
This policy initiative is a group of policies that ensures App Service is compliant per regulated Landing Zones.
ConvertTo-Bylaw converted this initiative, and proved that the file compiles back to the same definition.
Azure Policy JSONEnforce-Guardrails-AppServices.alz_policy_set_definition.json · 383 lines
{
"name": "Enforce-Guardrails-AppServices",
"properties": {
"description": "This policy initiative is a group of policies that ensures App Service is compliant per regulated Landing Zones.",
"displayName": "Enforce recommended guardrails for App Service",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "App Service",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.1.0"
},
"parameters": {
"appServiceAppHttps": {
"allowedValues": [
"Modify",
"Disabled"
],
"defaultValue": "Modify",
"type": "string"
},
"appServiceAppModifyPublicNetworkAccess": {
"allowedValues": [
"Modify",
"Disabled"
],
"defaultValue": "Modify",
"type": "string"
},
"appServiceAppSlotsRemoteDebugging": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists",
"type": "string"
},
"appServiceAppsModifyPublicNetworkAccess": {
"allowedValues": [
"Modify",
"Disabled"
],
"defaultValue": "Modify",
"type": "string"
},
"appServiceAppsRemoteDebugging": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists",
"type": "string"
},
"appServiceAppsRfc": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
},
"appServiceAppsVnetRouting": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
},
"appServiceByoc": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
},
"appServiceDisableLocalAuth": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists",
"type": "string"
},
"appServiceDisableLocalAuthFtp": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists",
"type": "string"
},
"appServiceEnvLatestVersion": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
},
"appServiceRfc": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
},
"appServiceRouting": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
},
"appServiceScmAuth": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists",
"type": "string"
},
"appServiceSkuPl": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
},
"functionAppDebugging": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists",
"type": "string"
},
"functionAppSlotsModifyHttps": {
"allowedValues": [
"Modify",
"Disabled"
],
"defaultValue": "Modify",
"type": "string"
},
"functionAppSlotsModifyPublicNetworkAccess": {
"allowedValues": [
"Modify",
"Disabled"
],
"defaultValue": "Modify",
"type": "string"
}
},
"policyDefinitions": [
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceByoc')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/Deny-AppService-without-BYOC",
"policyDefinitionReferenceId": "Deny-AppService-Byoc"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceAppsRemoteDebugging')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/a5e3fe8f-f6cd-4f1d-bbf6-c749754a724b",
"policyDefinitionReferenceId": "Dine-AppService-Apps-Remote-Debugging"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceAppSlotsRemoteDebugging')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/cca5adfe-626b-4cc6-8522-f5b6ed2391bd",
"policyDefinitionReferenceId": "Deny-AppService-Slots-Remote-Debugging"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceEnvLatestVersion')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/eb4d34ab-0929-491c-bbf3-61e13da19f9a",
"policyDefinitionReferenceId": "Deny-AppService-Latest-Version"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceAppsVnetRouting')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/801543d1-1953-4a90-b8b0-8cf6d41473a5",
"policyDefinitionReferenceId": "Deny-AppService-Vnet-Routing"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceRfc')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/f5c0bfb3-acea-47b1-b477-b0edcdf6edc1",
"policyDefinitionReferenceId": "Deny-AppService-Rfc"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceAppsRfc')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/a691eacb-474d-47e4-b287-b4813ca44222",
"policyDefinitionReferenceId": "Deny-AppServiceApps-Rfc"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('functionAppDebugging')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/70adbb40-e092-42d5-a6f8-71c540a5efdb",
"policyDefinitionReferenceId": "DINE-FuncApp-Debugging"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceScmAuth')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/5e97b776-f380-4722-a9a3-e7f0be029e79",
"policyDefinitionReferenceId": "DINE-AppService-ScmAuth"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceRouting')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/5747353b-1ca9-42c1-a4dd-b874b894f3d4",
"policyDefinitionReferenceId": "Deny-AppServ-Routing"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceDisableLocalAuthFtp')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/572e342c-c920-4ef5-be2e-1ed3c6a51dc5",
"policyDefinitionReferenceId": "Deny-AppServ-FtpAuth"
},
{
"definitionVersion": "4.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceSkuPl')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/546fe8d2-368d-4029-a418-6af48a7f61e5",
"policyDefinitionReferenceId": "Deny-AppServ-SkuPl"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceDisableLocalAuth')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/2c034a29-2a5f-4857-b120-f800fe5549ae",
"policyDefinitionReferenceId": "DINE-AppService-LocalAuth"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('functionAppDebugging')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/25a5046c-c423-4805-9235-e844ae9ef49b",
"policyDefinitionReferenceId": "DINE-AppService-Debugging"
},
{
"definitionVersion": "2.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('functionAppSlotsModifyHttps')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/08cf2974-d178-48a0-b26d-f6b8e555748b",
"policyDefinitionReferenceId": "Modify-Function-Apps-Slots-Https"
},
{
"definitionVersion": "2.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceAppHttps')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/0f98368e-36bc-4716-8ac2-8f8067203b63",
"policyDefinitionReferenceId": "Modify-AppService-Https"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('functionAppSlotsModifyPublicNetworkAccess')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/242222f3-4985-4e99-b5ef-086d6a6cb01c",
"policyDefinitionReferenceId": "Modify-Function-Apps-Slots-Public-Network-Access"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceAppsModifyPublicNetworkAccess')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/2374605e-3e0b-492b-9046-229af202562c",
"policyDefinitionReferenceId": "Modify-AppService-Apps-Public-Network-Access"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('appServiceAppModifyPublicNetworkAccess')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/c6c3e00e-d414-4ca4-914f-406699bb8eee",
"policyDefinitionReferenceId": "Modify-AppService-App-Public-Network-Access"
}
],
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policySetDefinitions"
}BylawEnforce-Guardrails-AppServices.bylaw.ps1 · 273 lines
# Converted from Enforce-Guardrails-AppServices.alz_policy_set_definition.json by ConvertTo-Bylaw.
Initiative 'Enforce-Guardrails-AppServices' {
Properties @{
DisplayName = 'Enforce recommended guardrails for App Service'
Description = 'This policy initiative is a group of policies that ensures App Service is compliant per regulated Landing Zones.'
Category = 'App Service'
Version = '1.1.0'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter AppServiceAppHttps @{
Type = 'string'
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
}
Parameter AppServiceAppModifyPublicNetworkAccess @{
Type = 'string'
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
}
Parameter AppServiceAppSlotsRemoteDebugging @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
}
Parameter AppServiceAppsModifyPublicNetworkAccess @{
Type = 'string'
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
}
Parameter AppServiceAppsRemoteDebugging @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
}
Parameter AppServiceAppsRfc @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
Parameter AppServiceAppsVnetRouting @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
Parameter AppServiceByoc @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
Parameter AppServiceDisableLocalAuth @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
}
Parameter AppServiceDisableLocalAuthFtp @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
}
Parameter AppServiceEnvLatestVersion @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
Parameter AppServiceRfc @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
Parameter AppServiceRouting @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
Parameter AppServiceScmAuth @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
}
Parameter AppServiceSkuPl @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
Parameter FunctionAppDebugging @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
}
Parameter FunctionAppSlotsModifyHttps @{
Type = 'string'
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
}
Parameter FunctionAppSlotsModifyPublicNetworkAccess @{
Type = 'string'
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
}
PolicyDefinition @{
Id = '/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/Deny-AppService-without-BYOC'
ReferenceId = 'Deny-AppService-Byoc'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceByoc)
}
}
PolicyDefinition @{
Id = 'a5e3fe8f-f6cd-4f1d-bbf6-c749754a724b'
ReferenceId = 'Dine-AppService-Apps-Remote-Debugging'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceAppsRemoteDebugging)
}
}
PolicyDefinition @{
Id = 'cca5adfe-626b-4cc6-8522-f5b6ed2391bd'
ReferenceId = 'Deny-AppService-Slots-Remote-Debugging'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceAppSlotsRemoteDebugging)
}
}
PolicyDefinition @{
Id = 'eb4d34ab-0929-491c-bbf3-61e13da19f9a'
ReferenceId = 'Deny-AppService-Latest-Version'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceEnvLatestVersion)
}
}
PolicyDefinition @{
Id = '801543d1-1953-4a90-b8b0-8cf6d41473a5'
ReferenceId = 'Deny-AppService-Vnet-Routing'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceAppsVnetRouting)
}
}
PolicyDefinition @{
Id = 'f5c0bfb3-acea-47b1-b477-b0edcdf6edc1'
ReferenceId = 'Deny-AppService-Rfc'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceRfc)
}
}
PolicyDefinition @{
Id = 'a691eacb-474d-47e4-b287-b4813ca44222'
ReferenceId = 'Deny-AppServiceApps-Rfc'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceAppsRfc)
}
}
PolicyDefinition @{
Id = '70adbb40-e092-42d5-a6f8-71c540a5efdb'
ReferenceId = 'DINE-FuncApp-Debugging'
Version = '1.*.*'
Parameters = @{
effect = (Param FunctionAppDebugging)
}
}
PolicyDefinition @{
Id = '5e97b776-f380-4722-a9a3-e7f0be029e79'
ReferenceId = 'DINE-AppService-ScmAuth'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceScmAuth)
}
}
PolicyDefinition @{
Id = '5747353b-1ca9-42c1-a4dd-b874b894f3d4'
ReferenceId = 'Deny-AppServ-Routing'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceRouting)
}
}
PolicyDefinition @{
Id = '572e342c-c920-4ef5-be2e-1ed3c6a51dc5'
ReferenceId = 'Deny-AppServ-FtpAuth'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceDisableLocalAuthFtp)
}
}
PolicyDefinition @{
Id = '546fe8d2-368d-4029-a418-6af48a7f61e5'
ReferenceId = 'Deny-AppServ-SkuPl'
Version = '4.*.*'
Parameters = @{
effect = (Param AppServiceSkuPl)
}
}
PolicyDefinition @{
Id = '2c034a29-2a5f-4857-b120-f800fe5549ae'
ReferenceId = 'DINE-AppService-LocalAuth'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceDisableLocalAuth)
}
}
PolicyDefinition @{
Id = '25a5046c-c423-4805-9235-e844ae9ef49b'
ReferenceId = 'DINE-AppService-Debugging'
Version = '1.*.*'
Parameters = @{
effect = (Param FunctionAppDebugging)
}
}
PolicyDefinition @{
Id = '08cf2974-d178-48a0-b26d-f6b8e555748b'
ReferenceId = 'Modify-Function-Apps-Slots-Https'
Version = '2.*.*'
Parameters = @{
effect = (Param FunctionAppSlotsModifyHttps)
}
}
PolicyDefinition @{
Id = '0f98368e-36bc-4716-8ac2-8f8067203b63'
ReferenceId = 'Modify-AppService-Https'
Version = '2.*.*'
Parameters = @{
effect = (Param AppServiceAppHttps)
}
}
PolicyDefinition @{
Id = '242222f3-4985-4e99-b5ef-086d6a6cb01c'
ReferenceId = 'Modify-Function-Apps-Slots-Public-Network-Access'
Version = '1.*.*'
Parameters = @{
effect = (Param FunctionAppSlotsModifyPublicNetworkAccess)
}
}
PolicyDefinition @{
Id = '2374605e-3e0b-492b-9046-229af202562c'
ReferenceId = 'Modify-AppService-Apps-Public-Network-Access'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceAppsModifyPublicNetworkAccess)
}
}
PolicyDefinition @{
Id = 'c6c3e00e-d414-4ca4-914f-406699bb8eee'
ReferenceId = 'Modify-AppService-App-Public-Network-Access'
Version = '1.*.*'
Parameters = @{
effect = (Param AppServiceAppModifyPublicNetworkAccess)
}
}
}Members (19)
- App Service certificates must be stored in Key Vault
- Configure App Service apps to turn off remote debugging
- Configure App Service app slots to turn off remote debugging
- [Deprecated]: App Service Environment should be provisioned with latest versions
- App Service apps should enable configuration routing to Azure Virtual Network
- App Service app slots should enable outbound application traffic routing to Azure Virtual Network
- App Service apps should enable outbound application traffic routing to Azure Virtual Network
- Configure Function app slots to turn off remote debugging
- Configure App Service apps to disable local authentication for SCM sites
- App Service app slots should enable configuration routing to Azure Virtual Network
- Configure App Service apps to disable local authentication for FTP deployments
- App Service apps should use a SKU that supports private link
- Configure App Service app slots to disable local authentication for SCM sites
- Configure Function apps to turn off remote debugging
- Configure Function app slots to only be accessible over HTTPS
- Configure App Service apps to only be accessible over HTTPS
- Configure Function app slots to disable public network access
- Configure App Service apps to disable public network access
- Configure App Service app slots to disable public network access
Source: policy_set_definitions/Enforce-Guardrails-AppServices.alz_policy_set_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw