Bylaw

Gallery › Communication › Azure built-in policies

Communication services should have local authentication disabled

Converted Policy Disabled Modify Mode Indexed Version 1.1.0

This policy ensures that local authentication methods are disabled for Communication services, requiring Microsoft Entra ID identities for authentication. Enforcing this policy helps improve security by preventing the use of less secure local authentication.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONCommunication_DisableLocalAuth_Modify.json · 63 lines
{
  "properties": {
    "displayName": "Communication services should have local authentication disabled",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy ensures that local authentication methods are disabled for Communication services, requiring Microsoft Entra ID identities for authentication. Enforcing this policy helps improve security by preventing the use of less secure local authentication.",
    "metadata": {
      "category": "Communication",
      "version": "1.1.0"
    },
    "version": "1.1.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.Communication/communicationServices"
          },
          {
            "field": "Microsoft.Communication/communicationServices/disableLocalAuth",
            "notEquals": true
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "conflictEffect": "audit",
          "roleDefinitionIds": [
            "/providers/Microsoft.Authorization/roleDefinitions/09976791-48a7-449e-bb21-39d1a415f350"
          ],
          "operations": [
            {
              "condition": "[greaterOrEquals(requestContext().apiVersion, '2025-05-01')]",
              "operation": "addOrReplace",
              "field": "Microsoft.Communication/communicationServices/disableLocalAuth",
              "value": true
            }
          ]
        }
      }
    },
    "versions": [
      "1.1.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/145408bc-d134-468a-ae3b-1eaf3b9e5ac7",
  "name": "145408bc-d134-468a-ae3b-1eaf3b9e5ac7"
}
Bylaw145408bc-d134-468a-ae3b-1eaf3b9e5ac7.bylaw.ps1 · 30 lines
# Converted from Communication_DisableLocalAuth_Modify.json by ConvertTo-Bylaw.
Policy '145408bc-d134-468a-ae3b-1eaf3b9e5ac7' {

    Properties @{
        DisplayName   = 'Communication services should have local authentication disabled'
        Description   = 'This policy ensures that local authentication methods are disabled for Communication services, requiring Microsoft Entra ID identities for authentication. Enforcing this policy helps improve security by preventing the use of less secure local authentication.'
        Category      = 'Communication'
        Version       = '1.1.0'
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Communication/communicationServices' {

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

    Modify -Role 'Communication and Email Service Owner' -ConflictEffect Audit -Effect (Param Effect) {
        Field disableLocalAuth | AddOrReplace $true -Condition (Arm '[greaterOrEquals(requestContext().apiVersion, ''2025-05-01'')]')
    }
}

Source: built-in-policies/policyDefinitions/Communication/Communication_DisableLocalAuth_Modify.json in Azure/azure-policy, under the MIT licence.