Gallery › SignalR › Azure built-in policies
Configure Azure SignalR Service to disable local authentication
Converted Policy Disabled Modify Mode Indexed Version 1.0.0
Disable local authentication methods so that your Azure SignalR 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 SignalR Service to disable local authentication",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Disable local authentication methods so that your Azure SignalR Service exclusively requires Azure Active Directory identities for authentication.",
"metadata": {
"version": "1.0.0",
"category": "SignalR"
},
"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/SignalR"
},
{
"field": "Microsoft.SignalRService/SignalR/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-06-01-preview')]",
"operation": "addOrReplace",
"field": "Microsoft.SignalRService/SignalR/disableLocalAuth",
"value": true
}
]
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/702133e5-5ec5-4f90-9638-c78e22f13b39",
"name": "702133e5-5ec5-4f90-9638-c78e22f13b39"
}Bylaw702133e5-5ec5-4f90-9638-c78e22f13b39.bylaw.ps1 · 30 lines
# Converted from DisableLocalAuth_Modify.json by ConvertTo-Bylaw.
Policy '702133e5-5ec5-4f90-9638-c78e22f13b39' {
Properties @{
DisplayName = 'Configure Azure SignalR Service to disable local authentication'
Description = 'Disable local authentication methods so that your Azure SignalR Service exclusively requires Azure Active Directory identities for authentication.'
Version = '1.0.0'
Category = 'SignalR'
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/SignalR' {
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-06-01-preview'')]')
}
}Source: built-in-policies/policyDefinitions/SignalR/DisableLocalAuth_Modify.json in Azure/azure-policy, under the MIT licence.
Bylaw