Bylaw

Gallery › Azure Purview › Azure built-in policies

Azure Purview accounts should use private link

Converted Policy Audit 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 Azure Purview accounts instead of the entire service, you'll also be protected against data leakage risks. Learn more at: https://aka.ms/purview-private-link.

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

Azure Policy JSONPurview_PrivateEndPoint_Audit.json · 55 lines
{
  "properties": {
    "displayName": "Azure Purview accounts should use private link",
    "policyType": "BuiltIn",
    "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 Azure Purview accounts instead of the entire service, you'll also be protected against data leakage risks. Learn more at: https://aka.ms/purview-private-link.",
    "mode": "Indexed",
    "metadata": {
      "version": "1.0.0",
      "category": "Azure Purview"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Purview/accounts"
          },
          {
            "count": {
              "field": "Microsoft.Purview/accounts/privateEndpointConnections[*]",
              "where": {
                "field": "Microsoft.Purview/accounts/privateEndpointConnections[*].privateLinkServiceConnectionState.status",
                "equals": "Approved"
              }
            },
            "less": 1
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/9259053b-ddb8-40ab-842a-0aef19d0ade4",
  "name": "9259053b-ddb8-40ab-842a-0aef19d0ade4"
}
Bylaw9259053b-ddb8-40ab-842a-0aef19d0ade4.bylaw.ps1 · 30 lines
# Converted from Purview_PrivateEndPoint_Audit.json by ConvertTo-Bylaw.
Policy '9259053b-ddb8-40ab-842a-0aef19d0ade4' {

    Properties @{
        DisplayName   = 'Azure Purview accounts should use private link'
        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 Azure Purview accounts instead of the entire service, you''ll also be protected against data leakage risks. Learn more at: https://aka.ms/purview-private-link.'
        Version       = '1.0.0'
        Category      = 'Azure Purview'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Purview/accounts' {

        Require 'privateEndpointConnections and privateLinkServiceConnectionState.status are as required' {
            Count 'privateEndpointConnections[*]' -Where {
                Field privateLinkServiceConnectionState.status | Must -Be 'Approved'
            } | Must -BeGreaterOrEqual 1
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Azure Purview/Purview_PrivateEndPoint_Audit.json in Azure/azure-policy, under the MIT licence.