Bylaw

Gallery › Network › Azure Community Policy

Deny Private Link Service

Converted Policy Audit Deny Disabled Mode All Version 1.0.0

Deny the creation of Private Link Services

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

Azure Policy JSONazurepolicy.json · 37 lines
{
    "name": "795feb0a-d94b-4bd4-84a0-9d4b311a7bb7",
    "type": "Microsoft.Authorization/policyDefinitions",
    "properties": {
        "displayName": "Deny Private Link Service",
        "mode": "All",
        "description": "Deny the creation of Private Link Services",
        "metadata": {
            "version": "1.0.0",
            "category": "Network"
        },
        "parameters": {
            "effect": {
                "type": "String",
                "metadata": {
                    "displayName": "Effect",
                    "description": "Deny, Audit or Disable the execution of the Policy"
                },
                "allowedValues": [
                    "Deny",
                    "Audit",
                    "Disabled"
                ],
                "defaultValue": "Audit"
            } 
        },
        "policyRule": {
            "if": {
                "field": "type",
                "equals": "Microsoft.Network/privateLinkServices"
            },
            "then": {
                "effect": "[parameters('effect')]"
            }
        }
    }
}
Bylaw795feb0a-d94b-4bd4-84a0-9d4b311a7bb7.bylaw.ps1 · 22 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '795feb0a-d94b-4bd4-84a0-9d4b311a7bb7' {

    Properties @{
        DisplayName = 'Deny Private Link Service'
        Description = 'Deny the creation of Private Link Services'
        Version     = '1.0.0'
        Category    = 'Network'
        Mode        = 'All'
    }

    Parameter Effect @{
        AllowedValues = @('Deny', 'Audit', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Deny, Audit or Disable the execution of the Policy'
    }

    Resource 'Microsoft.Network/privateLinkServices'

    Effect (Param Effect)
}

Source: policyDefinitions/Network/deny-private-link-service/azurepolicy.json in Azure/Community-Policy, under the MIT licence.