Gallery › Key Vault › Azure Community Policy
Prevent key vault access to trusted services
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
This policy prevents key vault access to trusted services.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 48 lines
{
"name": "8290d482-f869-48d8-a371-fbc3e1c2d040",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Prevent key vault access to trusted services",
"description": "This policy prevents key vault access to trusted services.",
"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"
},
{
"equals": "AzureServices",
"field": "Microsoft.KeyVault/Vaults/networkAcls.bypass"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw8290d482-f869-48d8-a371-fbc3e1c2d040.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '8290d482-f869-48d8-a371-fbc3e1c2d040' {
Properties @{
DisplayName = 'Prevent key vault access to trusted services'
Description = 'This policy prevents key vault access to trusted services.'
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 'networkAcls.bypass is not AzureServices' {
Field networkAcls.bypass | Must -Not -Be 'AzureServices' -IfPresent
}
}
Effect (Param Effect)
}Source: policyDefinitions/Key Vault/prevent-key-vault-access-to-trusted-services/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw