Bylaw

Gallery › Azure Arc › Azure built-in policies

Azure Arc Private Link Scopes should disable public network access

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Disabling public network access improves security by ensuring that Azure Arc resources cannot connect via the public internet. Creating private endpoints can limit exposure of Azure Arc resources. Learn more at: https://aka.ms/arc/privatelink.

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

Azure Policy JSONArc_PrivateLinkScope_PublicAccess_Deny.json · 50 lines
{
  "properties": {
    "displayName": "Azure Arc Private Link Scopes should disable public network access",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Disabling public network access improves security by ensuring that Azure Arc resources cannot connect via the public internet. Creating private endpoints can limit exposure of Azure Arc resources. Learn more at: https://aka.ms/arc/privatelink.",
    "metadata": {
      "version": "1.0.0",
      "category": "Azure Arc"
    },
    "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.HybridCompute/privateLinkScopes"
          },
          {
            "field": "Microsoft.HybridCompute/privateLinkScopes/publicNetworkAccess",
            "notEquals": "Disabled"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/898f2439-3333-4713-af25-f1d78bc50556",
  "name": "898f2439-3333-4713-af25-f1d78bc50556"
}
Bylaw898f2439-3333-4713-af25-f1d78bc50556.bylaw.ps1 · 28 lines
# Converted from Arc_PrivateLinkScope_PublicAccess_Deny.json by ConvertTo-Bylaw.
Policy '898f2439-3333-4713-af25-f1d78bc50556' {

    Properties @{
        DisplayName   = 'Azure Arc Private Link Scopes should disable public network access'
        Description   = 'Disabling public network access improves security by ensuring that Azure Arc resources cannot connect via the public internet. Creating private endpoints can limit exposure of Azure Arc resources. Learn more at: https://aka.ms/arc/privatelink.'
        Version       = '1.0.0'
        Category      = 'Azure Arc'
        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.HybridCompute/privateLinkScopes' {

        Require 'publicNetworkAccess is Disabled' {
            Field publicNetworkAccess | Must -Be 'Disabled'
        }
    }

    Effect (Param Effect)
}

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