Bylaw

Gallery › Bot Service › Azure built-in policies

Bot 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 a bot uses AAD exclusively for authentication.

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

Azure Policy JSONDisableLocalAuth_Audit.json · 51 lines
{
  "properties": {
    "displayName": "Bot Service should have local authentication methods disabled",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Disabling local authentication methods improves security by ensuring that a bot uses AAD exclusively for authentication.",
    "metadata": {
      "version": "1.0.0",
      "category": "Bot Service"
    },
    "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.BotService/botServices"
          },
          {
            "field": "Microsoft.BotService/botServices/disableLocalAuth",
            "notEquals": true
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/ffea632e-4e3a-4424-bf78-10e179bb2e1a",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "ffea632e-4e3a-4424-bf78-10e179bb2e1a"
}
Bylawffea632e-4e3a-4424-bf78-10e179bb2e1a.bylaw.ps1 · 28 lines
# Converted from DisableLocalAuth_Audit.json by ConvertTo-Bylaw.
Policy 'ffea632e-4e3a-4424-bf78-10e179bb2e1a' {

    Properties @{
        DisplayName   = 'Bot Service should have local authentication methods disabled'
        Description   = 'Disabling local authentication methods improves security by ensuring that a bot uses AAD exclusively for authentication.'
        Version       = '1.0.0'
        Category      = 'Bot Service'
        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.BotService/botServices' {

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

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Bot Service/DisableLocalAuth_Audit.json in Azure/azure-policy, under the MIT licence.