Bylaw

Gallery › Logic Apps › Azure Landing Zones Library

Logic app should only be accessible over HTTPS

Converted Policy Audit Deny Disabled Mode All Version 1.0.0

Use of HTTPS ensures server/service authentication and protects data in transit from network layer eavesdropping attacks.

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

Azure Policy JSONDeny-LogicApps-Without-Https.alz_policy_definition.json · 64 lines
{
  "name": "Deny-LogicApps-Without-Https",
  "properties": {
    "description": "Use of HTTPS ensures server/service authentication and protects data in transit from network layer eavesdropping attacks.",
    "displayName": "Logic app should only be accessible over HTTPS",
    "metadata": {
      "alzCloudEnvironments": [
        "AzureCloud",
        "AzureChinaCloud",
        "AzureUSGovernment"
      ],
      "category": "Logic Apps",
      "source": "https://github.com/Azure/Enterprise-Scale/",
      "version": "1.0.0"
    },
    "mode": "All",
    "parameters": {
      "effect": {
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Deny",
        "metadata": {
          "description": "Enable or disable the execution of the policy",
          "displayName": "Effect"
        },
        "type": "String"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "equals": "Microsoft.Web/sites",
            "field": "type"
          },
          {
            "contains": "workflowapp",
            "field": "kind"
          },
          {
            "anyOf": [
              {
                "exists": "false",
                "field": "Microsoft.Web/sites/httpsOnly"
              },
              {
                "equals": "false",
                "field": "Microsoft.Web/sites/httpsOnly"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "policyType": "Custom"
  },
  "type": "Microsoft.Authorization/policyDefinitions"
}
BylawDeny-LogicApps-Without-Https.bylaw.ps1 · 36 lines
# Converted from Deny-LogicApps-Without-Https.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-LogicApps-Without-Https' {

    Properties @{
        DisplayName = 'Logic app should only be accessible over HTTPS'
        Description = 'Use of HTTPS ensures server/service authentication and protects data in transit from network layer eavesdropping attacks.'
        Category    = 'Logic Apps'
        Version     = '1.0.0'
        Mode        = 'All'
        Metadata    = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
    }

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

    Resource 'Microsoft.Web/sites' {

        When {
            Field kind | Must -ContainText 'workflowapp'
        }

        Require 'httpsOnly exists' {
            Field httpsOnly | Must -Exist
        }

        Require 'httpsOnly is not false' {
            Field httpsOnly | Must -Not -Be 'false' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: policy_definitions/Deny-LogicApps-Without-Https.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.