Gallery › App Service › Azure Community Policy
Web app require always on
Converted Policy Audit Deny Disabled Mode Indexed Version 1.1.0
Web app require always on
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 45 lines
{
"name": "20b21801-8432-4515-acf9-4dffc85b0413",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Web app require always on",
"description": "Web app require always on",
"metadata": {
"version": "1.1.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": "Microsoft.Web/sites/siteConfig.alwaysOn",
"equals": "false"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw20b21801-8432-4515-acf9-4dffc85b0413.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '20b21801-8432-4515-acf9-4dffc85b0413' {
Properties @{
DisplayName = 'Web app require always on'
Description = 'Web app require always on'
Version = '1.1.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' {
Require 'siteConfig.alwaysOn is not false' {
Field siteConfig.alwaysOn | Must -Not -Be 'false' -IfPresent
}
}
Effect (Param Effect)
}Source: policyDefinitions/App Service/web-app-require-always-on/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw