Bylaw

Gallery › Bot Service › Azure built-in policies

Bot Service should have public network access disabled

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Bots should be set to 'isolated only' mode. This setting configures Bot Service channels that require traffic over the public internet to be disabled.

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

Azure Policy JSONPublicNetworkAccess_Audit.json · 50 lines
{
  "properties": {
    "displayName": "Bot Service should have public network access disabled",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Bots should be set to 'isolated only' mode. This setting configures Bot Service channels that require traffic over the public internet to be disabled.",
    "metadata": {
      "version": "1.0.0",
      "category": "Bot Service"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "The desired effect of the policy."
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.BotService/botServices"
          },
          {
            "field": "Microsoft.BotService/botServices/publicNetworkAccess",
            "notEquals": "Disabled"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/5e8168db-69e3-4beb-9822-57cb59202a9d",
  "name": "5e8168db-69e3-4beb-9822-57cb59202a9d"
}
Bylaw5e8168db-69e3-4beb-9822-57cb59202a9d.bylaw.ps1 · 28 lines
# Converted from PublicNetworkAccess_Audit.json by ConvertTo-Bylaw.
Policy '5e8168db-69e3-4beb-9822-57cb59202a9d' {

    Properties @{
        DisplayName   = 'Bot Service should have public network access disabled'
        Description   = 'Bots should be set to ''isolated only'' mode. This setting configures Bot Service channels that require traffic over the public internet to be disabled.'
        Version       = '1.0.0'
        Category      = 'Bot Service'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'The desired effect of the policy.'
    }

    Resource 'Microsoft.BotService/botServices' {

        Require 'publicNetworkAccess is Disabled' {
            Field publicNetworkAccess | Must -Be 'Disabled'
        }
    }

    Effect (Param Effect)
}

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