Gallery › Monitoring › Azure built-in policies
Configure Azure Monitor Private Link Scope to block access to non private link resources
Converted Policy Disabled Modify Mode Indexed Version 1.0.0
Azure Private Link lets you connect your virtual networks to Azure resources through a private endpoint to an Azure Monitor Private Link scope (AMPLS). Private Link Access modes are set on your AMPLS to control whether ingestion and query requests from your networks can reach all resources, or only Private Link resources (to prevent data exfiltration). Learn more about private links at: https://docs.microsoft.com/azure/azure-monitor/logs/private-link-security#private-link-access-modes-private-only-vs-open.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "Configure Azure Monitor Private Link Scope to block access to non private link resources",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Azure Private Link lets you connect your virtual networks to Azure resources through a private endpoint to an Azure Monitor Private Link scope (AMPLS). Private Link Access modes are set on your AMPLS to control whether ingestion and query requests from your networks can reach all resources, or only Private Link resources (to prevent data exfiltration). Learn more about private links at: https://docs.microsoft.com/azure/azure-monitor/logs/private-link-security#private-link-access-modes-private-only-vs-open.",
"metadata": {
"version": "1.0.0",
"category": "Monitoring"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "The effect determines what happens when the policy rule is evaluated to match"
},
"allowedValues": [
"Modify",
"Disabled"
],
"defaultValue": "Modify"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Insights/privateLinkScopes"
},
{
"anyOf": [
{
"field": "Microsoft.Insights/privateLinkScopes/accessModeSettings.ingestionAccessMode",
"notEquals": "PrivateOnly"
},
{
"field": "Microsoft.Insights/privateLinkScopes/accessModeSettings.queryAccessMode",
"notEquals": "PrivateOnly"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
],
"conflictEffect": "Audit",
"operations": [
{
"operation": "addOrReplace",
"field": "Microsoft.Insights/privateLinkScopes/accessModeSettings.ingestionAccessMode",
"value": "PrivateOnly"
},
{
"operation": "addOrReplace",
"field": "Microsoft.Insights/privateLinkScopes/accessModeSettings.queryAccessMode",
"value": "PrivateOnly"
}
]
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/bec5db8e-c4e3-40f9-a545-e0bd00065c82",
"name": "bec5db8e-c4e3-40f9-a545-e0bd00065c82"
}# Converted from AzureMonitorPrivateLinkScopes_AccessModeSettings_Modify.json by ConvertTo-Bylaw.
Policy 'bec5db8e-c4e3-40f9-a545-e0bd00065c82' {
Properties @{
DisplayName = 'Configure Azure Monitor Private Link Scope to block access to non private link resources'
Description = 'Azure Private Link lets you connect your virtual networks to Azure resources through a private endpoint to an Azure Monitor Private Link scope (AMPLS). Private Link Access modes are set on your AMPLS to control whether ingestion and query requests from your networks can reach all resources, or only Private Link resources (to prevent data exfiltration). Learn more about private links at: https://docs.microsoft.com/azure/azure-monitor/logs/private-link-security#private-link-access-modes-private-only-vs-open.'
Version = '1.0.0'
Category = 'Monitoring'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
DisplayName = 'Effect'
Description = 'The effect determines what happens when the policy rule is evaluated to match'
}
Resource 'Microsoft.Insights/privateLinkScopes' {
Require 'accessModeSettings.ingestionAccessMode is PrivateOnly' {
Field accessModeSettings.ingestionAccessMode | Must -Be 'PrivateOnly'
}
Require 'accessModeSettings.queryAccessMode is PrivateOnly' {
Field accessModeSettings.queryAccessMode | Must -Be 'PrivateOnly'
}
}
Modify -Role 'Contributor' -ConflictEffect Audit -Effect (Param Effect) {
Field accessModeSettings.ingestionAccessMode | AddOrReplace 'PrivateOnly'
Field accessModeSettings.queryAccessMode | AddOrReplace 'PrivateOnly'
}
}Source: built-in-policies/policyDefinitions/Monitoring/AzureMonitorPrivateLinkScopes_AccessModeSettings_Modify.json in Azure/azure-policy, under the MIT licence.
Bylaw