Gallery › Web PubSub › Azure built-in policies
Configure Azure Web PubSub Service to disable local authentication
Converted Policy Disabled Modify Mode Indexed Version 1.0.0
Disable local authentication methods so that your Azure Web PubSub Service exclusively requires Azure Active Directory identities for authentication.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDisableLocalAuth_Modify.json · 63 lines
{
"properties": {
"displayName": "Configure Azure Web PubSub Service to disable local authentication",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Disable local authentication methods so that your Azure Web PubSub Service exclusively requires Azure Active Directory identities for authentication.",
"metadata": {
"version": "1.0.0",
"category": "Web PubSub"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"defaultValue": "Modify",
"allowedValues": [
"Modify",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.SignalRService/webPubSub"
},
{
"field": "Microsoft.SignalRService/webPubSub/disableLocalAuth",
"notEquals": true
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"conflictEffect": "audit",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/8cf5e20a-e4b2-4e9d-b3a1-5ceb692c2761"
],
"operations": [
{
"condition": "[greaterOrEquals(requestContext().apiVersion, '2021-08-01-preview')]",
"operation": "addOrReplace",
"field": "Microsoft.SignalRService/webPubSub/disableLocalAuth",
"value": true
}
]
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/17f9d984-90c8-43dd-b7a6-76cb694815c1",
"name": "17f9d984-90c8-43dd-b7a6-76cb694815c1"
}Bylaw17f9d984-90c8-43dd-b7a6-76cb694815c1.bylaw.ps1 · 30 lines
# Converted from DisableLocalAuth_Modify.json by ConvertTo-Bylaw.
Policy '17f9d984-90c8-43dd-b7a6-76cb694815c1' {
Properties @{
DisplayName = 'Configure Azure Web PubSub Service to disable local authentication'
Description = 'Disable local authentication methods so that your Azure Web PubSub Service exclusively requires Azure Active Directory identities for authentication.'
Version = '1.0.0'
Category = 'Web PubSub'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.SignalRService/webPubSub' {
Require 'disableLocalAuth is true' {
Field disableLocalAuth | Must -Be $true
}
}
Modify -Role 'SignalR/Web PubSub Contributor' -ConflictEffect Audit -Effect (Param Effect) {
Field disableLocalAuth | AddOrReplace $true -Condition (Arm '[greaterOrEquals(requestContext().apiVersion, ''2021-08-01-preview'')]')
}
}Source: built-in-policies/policyDefinitions/Web PubSub/DisableLocalAuth_Modify.json in Azure/azure-policy, under the MIT licence.
Bylaw