Bylaw

Gallery › Event Hub › Azure built-in policies

Azure Event Hub namespaces should have local authentication methods disabled

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.1

Disabling local authentication methods improves security by ensuring that Azure Event Hub namespaces exclusively require Microsoft Entra ID identities for authentication. Learn more at: https://aka.ms/disablelocalauth-eh.

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

Azure Policy JSONDisableLocalAuth_AuditDeny.json · 51 lines
{
  "properties": {
    "displayName": "Azure Event Hub namespaces should have local authentication methods disabled",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Disabling local authentication methods improves security by ensuring that Azure Event Hub namespaces exclusively require Microsoft Entra ID identities for authentication. Learn more at: https://aka.ms/disablelocalauth-eh.",
    "metadata": {
      "version": "1.0.1",
      "category": "Event Hub"
    },
    "version": "1.0.1",
    "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.EventHub/namespaces"
          },
          {
            "field": "Microsoft.EventHub/namespaces/disableLocalAuth",
            "notEquals": true
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.1",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/5d4e3c65-4873-47be-94f3-6f8b953a3598",
  "name": "5d4e3c65-4873-47be-94f3-6f8b953a3598"
}
Bylaw5d4e3c65-4873-47be-94f3-6f8b953a3598.bylaw.ps1 · 28 lines
# Converted from DisableLocalAuth_AuditDeny.json by ConvertTo-Bylaw.
Policy '5d4e3c65-4873-47be-94f3-6f8b953a3598' {

    Properties @{
        DisplayName   = 'Azure Event Hub namespaces should have local authentication methods disabled'
        Description   = 'Disabling local authentication methods improves security by ensuring that Azure Event Hub namespaces exclusively require Microsoft Entra ID identities for authentication. Learn more at: https://aka.ms/disablelocalauth-eh.'
        Version       = '1.0.1'
        Category      = 'Event Hub'
        PolicyVersion = '1.0.1'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.EventHub/namespaces' {

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

    Effect (Param Effect)
}

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