Bylaw

Gallery › Event Grid › Azure built-in policies

Azure Event Grid partner namespaces 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 partner namespaces 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 JSONPartnerNamespaces_DisableLocalAuth_AuditDeny.json · 50 lines
{
  "properties": {
    "displayName": "Azure Event Grid partner namespaces should have local authentication methods disabled",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Disabling local authentication methods improves security by ensuring that Azure Event Grid partner namespaces 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/partnerNamespaces"
          },
          {
            "field": "Microsoft.EventGrid/partnerNamespaces/disableLocalAuth",
            "notEquals": true
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/8632b003-3545-4b29-85e6-b2b96773df1e",
  "name": "8632b003-3545-4b29-85e6-b2b96773df1e"
}
Bylaw8632b003-3545-4b29-85e6-b2b96773df1e.bylaw.ps1 · 28 lines
# Converted from PartnerNamespaces_DisableLocalAuth_AuditDeny.json by ConvertTo-Bylaw.
Policy '8632b003-3545-4b29-85e6-b2b96773df1e' {

    Properties @{
        DisplayName   = 'Azure Event Grid partner namespaces should have local authentication methods disabled'
        Description   = 'Disabling local authentication methods improves security by ensuring that Azure Event Grid partner namespaces 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/partnerNamespaces' {

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

    Effect (Param Effect)
}

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