Gallery › Key Vault › Azure Community Policy
Enforce key vault premium SKU
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
This policy enforces premium sku for key vaults.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 48 lines
{
"name": "80cb9e61-f5f8-4ee4-ab86-132a5747bc18",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Enforce key vault premium SKU",
"description": "This policy enforces premium sku for key vaults.",
"metadata": {
"category": "Key Vault",
"createdBy": "",
"updatedBy": null,
"updatedOn": null,
"version": "1.0.0"
},
"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": [
{
"equals": "Microsoft.KeyVault/Vaults",
"field": "type"
},
{
"field": "Microsoft.KeyVault/Vaults/sku.name",
"notEquals": "premium"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw80cb9e61-f5f8-4ee4-ab86-132a5747bc18.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '80cb9e61-f5f8-4ee4-ab86-132a5747bc18' {
Properties @{
DisplayName = 'Enforce key vault premium SKU'
Description = 'This policy enforces premium sku for key vaults.'
Category = 'Key Vault'
Version = '1.0.0'
Mode = 'Indexed'
}
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 premium' {
Field sku.name | Must -Be 'premium'
}
}
Effect (Param Effect)
}Source: policyDefinitions/Key Vault/enforce-key-vault-premium-sku/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw