Bylaw

Gallery › Bot Service › Azure built-in policies

Bot Service endpoint should be a valid HTTPS URI

Converted Policy Audit Deny Disabled Mode Indexed Version 1.1.0

Data can be tampered with during transmission. Protocols exist that provide encryption to address problems of misuse and tampering. To ensure your bots are communicating only over encrypted channels, set the endpoint to a valid HTTPS URI. This ensures the HTTPS protocol is used to encrypt your data in transit and is also often a requirement for compliance with regulatory or industry standards. Please visit: https://docs.microsoft.com/azure/bot-service/bot-builder-security-guidelines.

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

Azure Policy JSONValidEndpoint_Audit.json · 53 lines
{
  "properties": {
    "displayName": "Bot Service endpoint should be a valid HTTPS URI",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Data can be tampered with during transmission. Protocols exist that provide encryption to address problems of misuse and tampering. To ensure your bots are communicating only over encrypted channels, set the endpoint to a valid HTTPS URI. This ensures the HTTPS protocol is used to encrypt your data in transit and is also often a requirement for compliance with regulatory or industry standards. Please visit: https://docs.microsoft.com/azure/bot-service/bot-builder-security-guidelines.",
    "metadata": {
      "version": "1.1.0",
      "category": "Bot Service"
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "The desired effect of the policy."
        },
        "allowedValues": [
          "audit",
          "Audit",
          "deny",
          "Deny",
          "disabled",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.BotService/botServices"
          },
          {
            "field": "Microsoft.BotService/botServices/endpoint",
            "notLike": "https://*"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.1.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/6164527b-e1ee-4882-8673-572f425f5e0a",
  "name": "6164527b-e1ee-4882-8673-572f425f5e0a"
}
Bylaw6164527b-e1ee-4882-8673-572f425f5e0a.bylaw.ps1 · 28 lines
# Converted from ValidEndpoint_Audit.json by ConvertTo-Bylaw.
Policy '6164527b-e1ee-4882-8673-572f425f5e0a' {

    Properties @{
        DisplayName   = 'Bot Service endpoint should be a valid HTTPS URI'
        Description   = 'Data can be tampered with during transmission. Protocols exist that provide encryption to address problems of misuse and tampering. To ensure your bots are communicating only over encrypted channels, set the endpoint to a valid HTTPS URI. This ensures the HTTPS protocol is used to encrypt your data in transit and is also often a requirement for compliance with regulatory or industry standards. Please visit: https://docs.microsoft.com/azure/bot-service/bot-builder-security-guidelines.'
        Version       = '1.1.0'
        Category      = 'Bot Service'
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.BotService/botServices' {

        Require 'endpoint is like https://*' {
            Field endpoint | Must -BeLike 'https://*'
        }
    }

    Effect (Param Effect)
}

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