Use managed identities for Web PubSub Services#
Security · Web PubSub Service · Rule · 2022_03 · Important
Configure Web PubSub Services to use managed identities to access Azure resources securely.
Description#
A managed identity allows your service to access other Azure AD-protected resources such as Azure Functions. The identity is managed by the Azure platform and doesn't require you to provision or rotate any secrets.
Using Azure managed identities have the following benefits:
- You don't need to store or manage credentials. Azure automatically generates tokens and performs rotation.
- You can use managed identities to authenticate to any Azure service that supports Azure AD authentication.
- Managed identities can be used without any additional cost.
Recommendation#
Consider configuring a managed identity for each Web PubSub Service. Also consider using managed identities to authenticate to related Azure services.
Examples#
Configure with Azure template#
To deploy services that pass this rule:
- Set the
identity.type
toSystemAssigned
orUserAssigned
. - If
identity.type
isUserAssigned
, reference the identity withidentity.userAssignedIdentities
.
For example:
Azure Template snippet
{
"type": "Microsoft.SignalRService/webPubSub",
"apiVersion": "2023-02-01",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard_S1"
},
"identity": {
"type": "SystemAssigned"
},
"properties": {
"disableLocalAuth": true
}
}
Configure with Bicep#
To deploy services that pass this rule:
- Set the
identity.type
toSystemAssigned
orUserAssigned
. - If
identity.type
isUserAssigned
, reference the identity withidentity.userAssignedIdentities
.
For example:
Azure Bicep snippet
resource service 'Microsoft.SignalRService/webPubSub@2023-02-01' = {
name: name
location: location
sku: {
name: 'Standard_S1'
}
identity: {
type: 'SystemAssigned'
}
properties: {
disableLocalAuth: true
}
}
Links#
- Use identity-based authentication
- Managed identities for Azure Web PubSub Service
- IM-1: Use centralized identity and authentication system
- IM-3: Manage application identities securely and automatically
- Azure deployment reference