Gallery › Key Vault › Azure Community Policy
Key Vault - SKU Setting DENY
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
This Azure Policy denies the creation of an Azure Key Vault when the 'SKU' setting is not included in the 'allowedSKUSetting' parameter.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 53 lines
{
"name": "cc054458-e66d-46ad-9621-294e722ea88e",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Key Vault - SKU Setting DENY",
"description": "This Azure Policy denies the creation of an Azure Key Vault when the 'SKU' setting is not included in the 'allowedSKUSetting' parameter.",
"metadata": {
"version": "1.0.0",
"category": "Key Vault"
},
"mode": "All",
"parameters": {
"allowedSKUSetting": {
"type": "String",
"metadata": {
"displayName": "Allowed SKU Setting",
"description": "The allowed SKU setting of an Azure Key Vault"
},
"defaultValue": "Premium"
},
"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.KeyVault/vaults"
},
{
"field": "Microsoft.KeyVault/vaults/sku.name",
"notEquals": "[parameters('allowedSKUSetting')]"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylawcc054458-e66d-46ad-9621-294e722ea88e.bylaw.ps1 · 32 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'cc054458-e66d-46ad-9621-294e722ea88e' {
Properties @{
DisplayName = 'Key Vault - SKU Setting DENY'
Description = 'This Azure Policy denies the creation of an Azure Key Vault when the ''SKU'' setting is not included in the ''allowedSKUSetting'' parameter.'
Version = '1.0.0'
Category = 'Key Vault'
Mode = 'All'
}
Parameter AllowedSKUSetting @{
Default = 'Premium'
DisplayName = 'Allowed SKU Setting'
Description = 'The allowed SKU setting of an Azure Key Vault'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Deny, Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.KeyVault/vaults' {
Require 'sku.name is the AllowedSKUSetting parameter' {
Field sku.name | Must -Be (Param AllowedSKUSetting)
}
}
Effect (Param Effect)
}Source: policyDefinitions/Key Vault/key-vault-sku-setting-deny/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw