Bylaw

Gallery › Policy › Azure Community Policy

Deny policy exemption without description

Converted Policy Audit Deny Disabled Mode All Version 1.0.0

Deny policy exemption without description

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

Azure Policy JSONazurepolicy.json · 45 lines
{
  "name": "503d4c56-85c7-44a7-8286-1e91b09d581c",
  "type": "Microsoft.Authorization/policyDefinitions",
  "properties": {
    "displayName": "Deny policy exemption without description",
    "description": "Deny policy exemption without description",
    "metadata": {
      "version": "1.0.0",
      "category": "Policy"
    },
    "mode": "All",
    "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": [
          {
            "field": "type",
            "equals": "Microsoft.Authorization/policyExemptions"
          },
          {
            "field": "Microsoft.Authorization/policyExemptions/description",
            "exists": false
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    }
  }
}
Bylaw503d4c56-85c7-44a7-8286-1e91b09d581c.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '503d4c56-85c7-44a7-8286-1e91b09d581c' {

    Properties @{
        DisplayName = 'Deny policy exemption without description'
        Description = 'Deny policy exemption without description'
        Version     = '1.0.0'
        Category    = 'Policy'
        Mode        = 'All'
    }

    Parameter Effect @{
        AllowedValues = @('Deny', 'Audit', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Deny, Audit or Disabled the execution of the Policy'
    }

    Resource 'Microsoft.Authorization/policyExemptions' {

        Require 'description exists' {
            Field description | Must -Exist
        }
    }

    Effect (Param Effect)
}

Source: policyDefinitions/Policy/deny-policy-exemption-without-description/azurepolicy.json in Azure/Community-Policy, under the MIT licence.