Bylaw

Gallery › Event Grid › Azure built-in policies

Azure Event Grid topics should have local authentication methods disabled

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Disabling local authentication methods improves security by ensuring that Azure Event Grid topics exclusively require Azure Active Directory identities for authentication. Learn more at: https://aka.ms/aeg-disablelocalauth.

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

Azure Policy JSONTopics_DisableLocalAuth_AuditDeny.json · 50 lines
{
  "properties": {
    "displayName": "Azure Event Grid topics should have local authentication methods disabled",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Disabling local authentication methods improves security by ensuring that Azure Event Grid topics exclusively require Azure Active Directory identities for authentication. Learn more at: https://aka.ms/aeg-disablelocalauth.",
    "metadata": {
      "version": "1.0.0",
      "category": "Event Grid"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "defaultValue": "Audit",
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.EventGrid/topics"
          },
          {
            "field": "Microsoft.EventGrid/topics/disableLocalAuth",
            "notEquals": true
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/ae9fb87f-8a17-4428-94a4-8135d431055c",
  "name": "ae9fb87f-8a17-4428-94a4-8135d431055c"
}
Bylawae9fb87f-8a17-4428-94a4-8135d431055c.bylaw.ps1 · 28 lines
# Converted from Topics_DisableLocalAuth_AuditDeny.json by ConvertTo-Bylaw.
Policy 'ae9fb87f-8a17-4428-94a4-8135d431055c' {

    Properties @{
        DisplayName   = 'Azure Event Grid topics should have local authentication methods disabled'
        Description   = 'Disabling local authentication methods improves security by ensuring that Azure Event Grid topics exclusively require Azure Active Directory identities for authentication. Learn more at: https://aka.ms/aeg-disablelocalauth.'
        Version       = '1.0.0'
        Category      = 'Event Grid'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.EventGrid/topics' {

        Require 'disableLocalAuth is true' {
            Field disableLocalAuth | Must -Be $true
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Event Grid/Topics_DisableLocalAuth_AuditDeny.json in Azure/azure-policy, under the MIT licence.