Bylaw

Gallery › HorizonDB › Azure built-in policies

[Preview]: Azure HorizonDB clusters should use private endpoints

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0-preview Preview

Private endpoints enable private connectivity to Azure HorizonDB clusters from a virtual network using Azure Private Link. An approved connection is required for private access; public network access must be disabled separately to restrict access to private endpoints.

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

Azure Policy JSONClusters_EnablePrivateEndpoint_AINE.json · 49 lines
{
  "properties": {
    "displayName": "[Preview]: Azure HorizonDB clusters should use private endpoints",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Private endpoints enable private connectivity to Azure HorizonDB clusters from a virtual network using Azure Private Link. An approved connection is required for private access; public network access must be disabled separately to restrict access to private endpoints.",
    "metadata": {
      "version": "1.0.0-preview",
      "category": "HorizonDB",
      "preview": true
    },
    "version": "1.0.0-preview",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "defaultValue": "AuditIfNotExists"
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.HorizonDb/clusters"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.HorizonDb/clusters/privateEndpointConnections",
          "existenceCondition": {
            "field": "Microsoft.HorizonDb/clusters/privateEndpointConnections/privateLinkServiceConnectionState.status",
            "equals": "Approved"
          }
        }
      }
    },
    "versions": [
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/6ba69446-e019-4750-a1be-c3f05871b99b",
  "name": "6ba69446-e019-4750-a1be-c3f05871b99b"
}
Bylaw6ba69446-e019-4750-a1be-c3f05871b99b.bylaw.ps1 · 28 lines
# Converted from Clusters_EnablePrivateEndpoint_AINE.json by ConvertTo-Bylaw.
Policy '6ba69446-e019-4750-a1be-c3f05871b99b' {

    Properties @{
        DisplayName   = '[Preview]: Azure HorizonDB clusters should use private endpoints'
        Description   = 'Private endpoints enable private connectivity to Azure HorizonDB clusters from a virtual network using Azure Private Link. An approved connection is required for private access; public network access must be disabled separately to restrict access to private endpoints.'
        Version       = '1.0.0-preview'
        Category      = 'HorizonDB'
        Preview       = $true
        PolicyVersion = '1.0.0-preview'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.HorizonDb/clusters'

    AuditIfNotExists 'Microsoft.HorizonDb/clusters/privateEndpointConnections' -Effect (Param Effect) {
        Require 'privateLinkServiceConnectionState.status is Approved' {
            Field privateLinkServiceConnectionState.status | Must -Be 'Approved'
        }
    }
}

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