Gallery › Azure Arc › Azure built-in policies
Configure Azure Arc-enabled Kubernetes clusters to use an Azure Arc Private Link Scope
Converted Policy Disabled Modify Mode Indexed Version 1.0.0
Azure Private Link lets you connect your virtual networks 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 Azure Arc-enabled servers to an Azure Arc Private Link Scope that is configured with a private endpoint, data leakage risks are reduced. Learn more about private links at: https://aka.ms/arc/privatelink.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "Configure Azure Arc-enabled Kubernetes clusters to use an Azure Arc Private Link Scope",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Azure Private Link lets you connect your virtual networks 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 Azure Arc-enabled servers to an Azure Arc Private Link Scope that is configured with a private endpoint, data leakage risks are reduced. Learn more about private links at: https://aka.ms/arc/privatelink.",
"metadata": {
"version": "1.0.0",
"category": "Azure Arc"
},
"version": "1.0.0",
"parameters": {
"privateLinkScopeId": {
"type": "String",
"metadata": {
"displayName": "Azure Arc Private Link Scope ID",
"description": "The Azure Arc Private Link Scope to associate with the Azure Arc-enabled kubernetes cluster.",
"strongType": "Microsoft.HybridCompute/privateLinkScopes"
}
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Modify",
"Disabled"
],
"defaultValue": "Modify"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Kubernetes/connectedClusters"
},
{
"field": "Microsoft.Kubernetes/connectedClusters/privateLinkScopeResourceId",
"notEquals": "[parameters('privateLinkScopeId')]"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"conflictEffect": "audit",
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/34e09817-6cbe-4d01-b1a2-e0eac5743d41"
],
"operations": [
{
"condition": "[greaterOrEquals(requestContext().apiVersion, '2022-05-01-preview')]",
"operation": "addOrReplace",
"field": "Microsoft.Kubernetes/connectedClusters/privateLinkScopeResourceId",
"value": "[parameters('privateLinkScopeId')]"
},
{
"condition": "[greaterOrEquals(requestContext().apiVersion, '2022-05-01-preview')]",
"operation": "addOrReplace",
"field": "Microsoft.Kubernetes/connectedClusters/privateLinkState",
"value": "true"
}
]
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/4002015b-1272-4dfb-8943-fed4aeec39b6",
"name": "4002015b-1272-4dfb-8943-fed4aeec39b6"
}# Converted from Arc_KubernetesCluster_PrivateLinkEnabled_Modify.json by ConvertTo-Bylaw.
Policy '4002015b-1272-4dfb-8943-fed4aeec39b6' {
Properties @{
DisplayName = 'Configure Azure Arc-enabled Kubernetes clusters to use an Azure Arc Private Link Scope'
Description = 'Azure Private Link lets you connect your virtual networks 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 Azure Arc-enabled servers to an Azure Arc Private Link Scope that is configured with a private endpoint, data leakage risks are reduced. Learn more about private links at: https://aka.ms/arc/privatelink.'
Version = '1.0.0'
Category = 'Azure Arc'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter PrivateLinkScopeId @{
Type = 'String'
DisplayName = 'Azure Arc Private Link Scope ID'
Description = 'The Azure Arc Private Link Scope to associate with the Azure Arc-enabled kubernetes cluster.'
Metadata = [ordered]@{ strongType = 'Microsoft.HybridCompute/privateLinkScopes' }
}
Parameter Effect @{
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Kubernetes/connectedClusters' {
Require 'privateLinkScopeResourceId is the PrivateLinkScopeId parameter' {
Field privateLinkScopeResourceId | Must -Be (Param PrivateLinkScopeId)
}
}
Modify -Role 'Kubernetes Cluster - Azure Arc Onboarding' -ConflictEffect Audit -Effect (Param Effect) {
Field privateLinkScopeResourceId | AddOrReplace (Param PrivateLinkScopeId) -Condition (Arm '[greaterOrEquals(requestContext().apiVersion, ''2022-05-01-preview'')]')
Field privateLinkState | AddOrReplace 'true' -Condition (Arm '[greaterOrEquals(requestContext().apiVersion, ''2022-05-01-preview'')]')
}
}Source: built-in-policies/policyDefinitions/Azure Arc/Arc_KubernetesCluster_PrivateLinkEnabled_Modify.json in Azure/azure-policy, under the MIT licence.
Bylaw