Use identity-based authentication for Service Bus namespaces#
Security · Service Bus · Rule · 2022_03 · Important
Authenticate Service Bus publishers and consumers with Entra ID identities.
Description#
To publish or consume messages from Service Bus cryptographic keys, or Entra ID identities can be used. Cryptographic keys include Shared Access Policy keys or Shared Access Signature (SAS) tokens. With Entra ID authentication, the identity is validated against Entra ID. Using Entra ID identities centralizes identity management and auditing.
Once you decide to use Entra ID authentication, you can disable authentication using keys or SAS tokens.
Recommendation#
Consider only using Entra ID identities to publish or consume messages from Service Bus. Then disable authentication based on access keys or SAS tokens.
Examples#
Configure with Azure template#
To deploy namespaces that pass this rule:
- Set the
properties.disableLocalAuth
property totrue
.
For example:
{
"type": "Microsoft.ServiceBus/namespaces",
"apiVersion": "2022-10-01-preview",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"identity": {
"type": "SystemAssigned"
},
"sku": {
"name": "Standard"
},
"properties": {
"disableLocalAuth": true,
"minimumTlsVersion": "1.2"
}
}
Configure with Bicep#
To deploy namespaces that pass this rule:
- Set the
properties.disableLocalAuth
property totrue
.
For example:
resource ns 'Microsoft.ServiceBus/namespaces@2022-10-01-preview' = {
name: name
location: location
identity: {
type: 'SystemAssigned'
}
sku: {
name: 'Standard'
}
properties: {
disableLocalAuth: true
minimumTlsVersion: '1.2'
}
}
Configure with Azure Verified Modules
A pre-validated module supported by Microsoft is available from the Azure Bicep public registry. To reference the module, please use the following syntax:
To use the latest version:
Configure with Azure Policy#
To address this issue at runtime use the following policies:
- Azure Service Bus namespaces should have local authentication methods disabled
/providers/Microsoft.Authorization/policyDefinitions/cfb11c26-f069-4c14-8e36-56c394dae5af
- Configure Azure Service Bus namespaces to disable local authentication
/providers/Microsoft.Authorization/policyDefinitions/910711a6-8aa2-4f15-ae62-1e5b2ed3ef9e
Links#
- SE:05 Identity and access management
- IM-1: Use centralized identity and authentication system
- Service Bus authentication and authorization
- Azure deployment reference