Gallery › App Service › Azure Community Policy
Function apps must be deployed to an App Service Environment (ASE)
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
need to add description
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 49 lines
{
"name": "330a30ab-10db-4a0a-9b65-7aed65bc5fab",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Function apps must be deployed to an App Service Environment (ASE)",
"description": "need to add description",
"metadata": {
"version": "1.0.0",
"category": "App Service"
},
"mode": "Indexed",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Web/sites"
},
{
"field": "kind",
"contains": "functionapp"
},
{
"field": "Microsoft.Web/sites/hostingEnvironmentProfile.id",
"exists": false
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw330a30ab-10db-4a0a-9b65-7aed65bc5fab.bylaw.ps1 · 31 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '330a30ab-10db-4a0a-9b65-7aed65bc5fab' {
Properties @{
DisplayName = 'Function apps must be deployed to an App Service Environment (ASE)'
Description = 'need to add description'
Version = '1.0.0'
Category = 'App Service'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Deny, Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.Web/sites' {
When {
Field kind | Must -ContainText 'functionapp'
}
Require 'hostingEnvironmentProfile.id exists' {
Field hostingEnvironmentProfile.id | Must -Exist
}
}
Effect (Param Effect)
}Source: policyDefinitions/App Service/function-apps-must-be-deployed-to-an-app-service-environment-ase/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw