Bylaw

Gallery › Web PubSub › Azure built-in policies

Azure Web PubSub Service should use a SKU that supports private link

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

With supported SKU, Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to Azure Web PubSub service, you can reduce data leakage risks. Learn more about private links at: https://aka.ms/awps/privatelink.

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

Azure Policy JSONAllowedSKU_AuditDeny.json · 50 lines
{
  "properties": {
    "displayName": "Azure Web PubSub Service should use a SKU that supports private link",
    "description": "With supported SKU, Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to Azure Web PubSub service, you can reduce data leakage risks. Learn more about private links at: https://aka.ms/awps/privatelink.",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "metadata": {
      "version": "1.0.0",
      "category": "Web PubSub"
    },
    "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.SignalRService/webPubSub"
          },
          {
            "field": "Microsoft.SignalRService/webPubSub/sku.tier",
            "equals": "Free"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/82909236-25f3-46a6-841c-fe1020f95ae1",
  "name": "82909236-25f3-46a6-841c-fe1020f95ae1"
}
Bylaw82909236-25f3-46a6-841c-fe1020f95ae1.bylaw.ps1 · 28 lines
# Converted from AllowedSKU_AuditDeny.json by ConvertTo-Bylaw.
Policy '82909236-25f3-46a6-841c-fe1020f95ae1' {

    Properties @{
        DisplayName   = 'Azure Web PubSub Service should use a SKU that supports private link'
        Description   = 'With supported SKU, Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to Azure Web PubSub service, you can reduce data leakage risks. Learn more about private links at: https://aka.ms/awps/privatelink.'
        Version       = '1.0.0'
        Category      = 'Web PubSub'
        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.SignalRService/webPubSub' {

        Require 'sku.tier is not Free' {
            Field sku.tier | Must -Not -Be 'Free' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Web PubSub/AllowedSKU_AuditDeny.json in Azure/azure-policy, under the MIT licence.