Gallery › Sovereignty › Azure built-in policies
[Preview]: Azure Kubernetes Service clusters should use private endpoints
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0-preview Preview
Azure Private Link lets you connect your virtual networks to Azure services without a public IP address at the source or destination. By requiring an approved private endpoint connection for Azure Kubernetes Service clusters, you can reduce exposure of the API server to the public internet.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAKS_PrivateEndpoint_AINE.json · 49 lines
{
"properties": {
"displayName": "[Preview]: Azure Kubernetes Service clusters should use private endpoints",
"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. By requiring an approved private endpoint connection for Azure Kubernetes Service clusters, you can reduce exposure of the API server to the public internet.",
"metadata": {
"version": "1.0.0-preview",
"preview": true,
"category": "Sovereignty"
},
"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.ContainerService/managedClusters"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.ContainerService/managedClusters/privateEndpointConnections",
"existenceCondition": {
"field": "Microsoft.ContainerService/managedClusters/privateEndpointConnections/privateLinkServiceConnectionState.status",
"equals": "Approved"
}
}
}
},
"versions": [
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/973a0211-4dcc-42ea-87eb-e9be5db0e585",
"name": "973a0211-4dcc-42ea-87eb-e9be5db0e585"
}Bylaw973a0211-4dcc-42ea-87eb-e9be5db0e585.bylaw.ps1 · 28 lines
# Converted from AKS_PrivateEndpoint_AINE.json by ConvertTo-Bylaw.
Policy '973a0211-4dcc-42ea-87eb-e9be5db0e585' {
Properties @{
DisplayName = '[Preview]: Azure Kubernetes Service clusters should use private endpoints'
Description = 'Azure Private Link lets you connect your virtual networks to Azure services without a public IP address at the source or destination. By requiring an approved private endpoint connection for Azure Kubernetes Service clusters, you can reduce exposure of the API server to the public internet.'
Version = '1.0.0-preview'
Preview = $true
Category = 'Sovereignty'
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.ContainerService/managedClusters'
AuditIfNotExists 'Microsoft.ContainerService/managedClusters/privateEndpointConnections' -Effect (Param Effect) {
Require 'privateLinkServiceConnectionState.status is Approved' {
Field privateLinkServiceConnectionState.status | Must -Be 'Approved'
}
}
}Source: built-in-policies/policyDefinitions/Sovereignty/AKS_PrivateEndpoint_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw