Gallery › App Service › Azure Landing Zones Library
App Service certificates must be stored in Key Vault
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
App Service (including Logic apps and Function apps) must use certificates stored in Key Vault
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeny-AppService-without-BYOC.alz_policy_definition.json · 60 lines
{
"name": "Deny-AppService-without-BYOC",
"properties": {
"description": "App Service (including Logic apps and Function apps) must use certificates stored in Key Vault",
"displayName": "App Service certificates must be stored in Key Vault",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "App Service",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.0.0"
},
"mode": "All",
"parameters": {
"effect": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit",
"metadata": {
"description": "Enable or disable the execution of the policy",
"displayName": "Effect"
},
"type": "String"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.Web/certificates",
"field": "type"
},
{
"anyOf": [
{
"exists": "false",
"field": "Microsoft.Web/certificates/keyVaultId"
},
{
"exists": "false",
"field": "Microsoft.Web/certificates/keyVaultSecretName"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeny-AppService-without-BYOC.bylaw.ps1 · 32 lines
# Converted from Deny-AppService-without-BYOC.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-AppService-without-BYOC' {
Properties @{
DisplayName = 'App Service certificates must be stored in Key Vault'
Description = 'App Service (including Logic apps and Function apps) must use certificates stored in Key Vault'
Category = 'App Service'
Version = '1.0.0'
Mode = 'All'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Web/certificates' {
Require 'keyVaultId exists' {
Field keyVaultId | Must -Exist
}
Require 'keyVaultSecretName exists' {
Field keyVaultSecretName | Must -Exist
}
}
Effect (Param Effect)
}Source: policy_definitions/Deny-AppService-without-BYOC.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw