Bylaw

Gallery › Container Registry › Azure built-in policies

Container registries should have SKUs that support Private Links

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

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 your container registries instead of the entire service, data leakage risks are reduced. Learn more at: https://aka.ms/acr/private-link.

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

Azure Policy JSONACR_SkuSupportsPrivateEndpoints_AuditDeny.json · 50 lines
{
  "properties": {
    "displayName": "Container registries should have SKUs that support Private Links",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "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 your container registries instead of the entire service, data leakage risks are reduced. Learn more at: https://aka.ms/acr/private-link.",
    "metadata": {
      "version": "1.0.0",
      "category": "Container Registry"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "defaultValue": "Audit",
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.ContainerRegistry/registries"
          },
          {
            "field": "Microsoft.ContainerRegistry/registries/sku.name",
            "notEquals": "Premium"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/bd560fc0-3c69-498a-ae9f-aa8eb7de0e13",
  "name": "bd560fc0-3c69-498a-ae9f-aa8eb7de0e13"
}
Bylawbd560fc0-3c69-498a-ae9f-aa8eb7de0e13.bylaw.ps1 · 28 lines
# Converted from ACR_SkuSupportsPrivateEndpoints_AuditDeny.json by ConvertTo-Bylaw.
Policy 'bd560fc0-3c69-498a-ae9f-aa8eb7de0e13' {

    Properties @{
        DisplayName   = 'Container registries should have SKUs that support Private Links'
        Description   = '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 your container registries instead of the entire service, data leakage risks are reduced. Learn more at: https://aka.ms/acr/private-link.'
        Version       = '1.0.0'
        Category      = 'Container Registry'
        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.ContainerRegistry/registries' {

        Require 'sku.name is Premium' {
            Field sku.name | Must -Be 'Premium'
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Container Registry/ACR_SkuSupportsPrivateEndpoints_AuditDeny.json in Azure/azure-policy, under the MIT licence.