Gallery › Sovereignty › Azure built-in policies
[Preview]: API Management services should use private link
Converted Policy Audit Disabled Mode Indexed Version 1.0.0-preview Preview
API Management services should have at least one approved private endpoint connection. Clients in a virtual network can securely access API Management services that have private endpoint connections through private links.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONPrivateEndpointConnections_Audit.json · 56 lines
{
"properties": {
"displayName": "[Preview]: API Management services should use private link",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "API Management services should have at least one approved private endpoint connection. Clients in a virtual network can securely access API Management services that have private endpoint connections through private links.",
"metadata": {
"version": "1.0.0-preview",
"category": "Sovereignty",
"preview": true
},
"version": "1.0.0-preview",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.ApiManagement/service"
},
{
"count": {
"field": "Microsoft.ApiManagement/service/privateEndpointConnections[*]",
"where": {
"field": "Microsoft.ApiManagement/service/privateEndpointConnections[*].privateLinkServiceConnectionState.status",
"equals": "Approved"
}
},
"less": 1
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/37ccbf90-57ed-4a86-b246-cece8ed746fe",
"name": "37ccbf90-57ed-4a86-b246-cece8ed746fe"
}Bylaw37ccbf90-57ed-4a86-b246-cece8ed746fe.bylaw.ps1 · 31 lines
# Converted from PrivateEndpointConnections_Audit.json by ConvertTo-Bylaw.
Policy '37ccbf90-57ed-4a86-b246-cece8ed746fe' {
Properties @{
DisplayName = '[Preview]: API Management services should use private link'
Description = 'API Management services should have at least one approved private endpoint connection. Clients in a virtual network can securely access API Management services that have private endpoint connections through private links.'
Version = '1.0.0-preview'
Category = 'Sovereignty'
Preview = $true
PolicyVersion = '1.0.0-preview'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.ApiManagement/service' {
Require 'privateEndpointConnections and privateLinkServiceConnectionState.status are as required' {
Count 'privateEndpointConnections[*]' -Where {
Field privateLinkServiceConnectionState.status | Must -Be 'Approved'
} | Must -BeGreaterOrEqual 1
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Sovereignty/PrivateEndpointConnections_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw