Bylaw

Gallery › Attestation › Azure built-in policies

Azure Attestation providers should use private endpoints

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0

Private endpoints provide a way to connect Azure Attestation providers to your Azure resources without sending traffic over the public internet. By preventing public access, private endpoints help protect against undesired anonymous access.

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

Azure Policy JSONPrivateLink_AINE.json · 60 lines
{
  "properties": {
    "displayName": "Azure Attestation providers should use private endpoints",
    "description": "Private endpoints provide a way to connect Azure Attestation providers to your Azure resources without sending traffic over the public internet. By preventing public access, private endpoints help protect against undesired anonymous access.",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "metadata": {
      "version": "1.0.0",
      "category": "Attestation"
    },
    "version": "1.0.0",
    "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.Attestation/attestationProviders"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Attestation/attestationProviders/privateEndpointConnections",
          "existenceCondition": {
            "allOf": [
              {
                "field": "Microsoft.Attestation/attestationProviders/privateEndpointConnections/privateEndpoint",
                "exists": "true"
              },
              {
                "field": "Microsoft.Attestation/attestationProviders/privateEndpointConnections/provisioningState",
                "equals": "Succeeded"
              },
              {
                "field": "Microsoft.Attestation/attestationProviders/privateEndpointConnections/privateLinkServiceConnectionState.status",
                "equals": "Approved"
              }
            ]
          }
        }
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/7b256a2d-058b-41f8-bed9-3f870541c40a",
  "name": "7b256a2d-058b-41f8-bed9-3f870541c40a"
}
Bylaw7b256a2d-058b-41f8-bed9-3f870541c40a.bylaw.ps1 · 29 lines
# Converted from PrivateLink_AINE.json by ConvertTo-Bylaw.
Policy '7b256a2d-058b-41f8-bed9-3f870541c40a' {

    Properties @{
        DisplayName   = 'Azure Attestation providers should use private endpoints'
        Description   = 'Private endpoints provide a way to connect Azure Attestation providers to your Azure resources without sending traffic over the public internet. By preventing public access, private endpoints help protect against undesired anonymous access.'
        Version       = '1.0.0'
        Category      = 'Attestation'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Attestation/attestationProviders'

    AuditIfNotExists 'Microsoft.Attestation/attestationProviders/privateEndpointConnections' -Effect (Param Effect) {
        Require 'privateEndpoint, provisioningState and privateLinkServiceConnectionState.status are as required' {
            Field privateEndpoint | Must -Exist
            Field provisioningState | Must -Be 'Succeeded'
            Field privateLinkServiceConnectionState.status | Must -Be 'Approved'
        }
    }
}

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