Bylaw

Gallery › Key Vault › Azure Community Policy

Deny deployment with Azure RBAC enabled

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

This policy deny deployment with Azure RBAC enabled.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONazurepolicy.json · 48 lines
{
  "name": "2c6c0e99-0254-415e-9d1a-1b8621c93339",
  "type": "Microsoft.Authorization/policyDefinitions",
  "properties": {
    "displayName": "Deny deployment with Azure RBAC enabled",
    "description": "This policy deny deployment with Azure RBAC enabled.",
    "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": "true",
            "field": "Microsoft.KeyVault/vaults/enableRbacAuthorization"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    }
  }
}
Bylaw2c6c0e99-0254-415e-9d1a-1b8621c93339.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '2c6c0e99-0254-415e-9d1a-1b8621c93339' {

    Properties @{
        DisplayName = 'Deny deployment with Azure RBAC enabled'
        Description = 'This policy deny deployment with Azure RBAC enabled.'
        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 'enableRbacAuthorization is not true' {
            Field enableRbacAuthorization | Must -Not -Be 'true' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: policyDefinitions/Key Vault/deny-deployment-with-azure-rbac-enabled/azurepolicy.json in Azure/Community-Policy, under the MIT licence.