Bylaw

Gallery › Web PubSub › Azure built-in policies

Azure Web PubSub Service should have local authentication methods disabled

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Disabling local authentication methods improves security by ensuring that Azure Web PubSub Service exclusively require 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_AuditDeny.json · 50 lines
{
  "properties": {
    "displayName": "Azure Web PubSub Service should have local authentication methods disabled",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Disabling local authentication methods improves security by ensuring that Azure Web PubSub Service exclusively require Azure Active Directory identities for authentication.",
    "metadata": {
      "version": "1.0.0",
      "category": "Web PubSub"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.SignalRService/webPubSub"
          },
          {
            "field": "Microsoft.SignalRService/webPubSub/disableLocalAuth",
            "notEquals": true
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/b66ab71c-582d-4330-adfd-ac162e78691e",
  "name": "b66ab71c-582d-4330-adfd-ac162e78691e"
}
Bylawb66ab71c-582d-4330-adfd-ac162e78691e.bylaw.ps1 · 28 lines
# Converted from DisableLocalAuth_AuditDeny.json by ConvertTo-Bylaw.
Policy 'b66ab71c-582d-4330-adfd-ac162e78691e' {

    Properties @{
        DisplayName   = 'Azure Web PubSub Service should have local authentication methods disabled'
        Description   = 'Disabling local authentication methods improves security by ensuring that Azure Web PubSub Service exclusively require Azure Active Directory identities for authentication.'
        Version       = '1.0.0'
        Category      = 'Web PubSub'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.SignalRService/webPubSub' {

        Require 'disableLocalAuth is true' {
            Field disableLocalAuth | Must -Be $true
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Web PubSub/DisableLocalAuth_AuditDeny.json in Azure/azure-policy, under the MIT licence.