Use identity-based authentication for Event Grid topics
March 21, 2025 ยท View on GitHub
SYNOPSIS
Authenticate publishing clients with Azure AD identities.
DESCRIPTION
To publish events to Event Grid access keys, SAS tokens, or Azure AD identities can be used. With Azure AD authentication, the identity is validated against the Microsoft Identity Platform. Using Azure AD identities centralizes identity management and auditing.
Once you decide to use Azure AD authentication, you can disable authentication using keys or SAS tokens.
RECOMMENDATION
Consider only using Azure AD identities to publish events to Event Grid. Then disable authentication based on access keys or SAS tokens.
EXAMPLES
Configure with Azure template
To deploy Event Grid Topics that pass this rule:
- Set the
properties.disableLocalAuthproperty totrue.
For example:
{
"type": "Microsoft.EventGrid/topics",
"apiVersion": "2022-06-15",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"disableLocalAuth": true,
"publicNetworkAccess": "Disabled",
"inputSchema": "CloudEventSchemaV1_0"
}
}
Configure with Bicep
To deploy Event Grid Topics that pass this rule:
- Set the
properties.disableLocalAuthproperty totrue.
For example:
resource eventGrid 'Microsoft.EventGrid/topics@2022-06-15' = {
name: name
location: location
identity: {
type: 'SystemAssigned'
}
properties: {
disableLocalAuth: true
publicNetworkAccess: 'Disabled'
inputSchema: 'CloudEventSchemaV1_0'
}
}
Configure with Azure Policy
To address this issue at runtime use the following policies:
- Azure Event Grid topics should have local authentication methods disabled
- Configure Azure Event Grid topics to disable local authentication