Gallery › Monitoring › Azure built-in policies
Configure Azure Application Insights components to disable public network access for log ingestion and querying
Converted Policy Disabled Modify Mode Indexed Version 1.1.0
Disable components log ingestion and querying from public networks access to improve security. Only private-link connected networks will be able to ingest and query logs on this workspace. Learn more at https://aka.ms/AzMonPrivateLink#configure-application-insights.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONApplicationInsightsComponents_NetworkAccessEnabled_Modify.json · 75 lines
{
"properties": {
"displayName": "Configure Azure Application Insights components to disable public network access for log ingestion and querying",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Disable components log ingestion and querying from public networks access to improve security. Only private-link connected networks will be able to ingest and query logs on this workspace. Learn more at https://aka.ms/AzMonPrivateLink#configure-application-insights.",
"metadata": {
"version": "1.1.0",
"category": "Monitoring"
},
"version": "1.1.0",
"parameters": {
"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.Insights/components"
},
{
"anyOf": [
{
"field": "Microsoft.Insights/components/publicNetworkAccessForIngestion",
"notEquals": "Disabled"
},
{
"field": "Microsoft.Insights/components/publicNetworkAccessForQuery",
"notEquals": "Disabled"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"conflictEffect": "Audit",
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/ae349356-3a1b-4a5e-921d-050484c6347e"
],
"operations": [
{
"operation": "addOrReplace",
"field": "Microsoft.Insights/components/publicNetworkAccessForIngestion",
"value": "Disabled"
},
{
"operation": "addOrReplace",
"field": "Microsoft.Insights/components/publicNetworkAccessForQuery",
"value": "Disabled"
}
]
}
}
},
"versions": [
"1.1.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/dddfa1af-dcd6-42f4-b5b0-e1db01e0b405",
"name": "dddfa1af-dcd6-42f4-b5b0-e1db01e0b405"
}Bylawdddfa1af-dcd6-42f4-b5b0-e1db01e0b405.bylaw.ps1 · 35 lines
# Converted from ApplicationInsightsComponents_NetworkAccessEnabled_Modify.json by ConvertTo-Bylaw.
Policy 'dddfa1af-dcd6-42f4-b5b0-e1db01e0b405' {
Properties @{
DisplayName = 'Configure Azure Application Insights components to disable public network access for log ingestion and querying'
Description = 'Disable components log ingestion and querying from public networks access to improve security. Only private-link connected networks will be able to ingest and query logs on this workspace. Learn more at https://aka.ms/AzMonPrivateLink#configure-application-insights.'
Version = '1.1.0'
Category = 'Monitoring'
PolicyVersion = '1.1.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Insights/components' {
Require 'publicNetworkAccessForIngestion is Disabled' {
Field publicNetworkAccessForIngestion | Must -Be 'Disabled'
}
Require 'publicNetworkAccessForQuery is Disabled' {
Field publicNetworkAccessForQuery | Must -Be 'Disabled'
}
}
Modify -Role 'Application Insights Component Contributor' -ConflictEffect Audit -Effect (Param Effect) {
Field publicNetworkAccessForIngestion | AddOrReplace 'Disabled'
Field publicNetworkAccessForQuery | AddOrReplace 'Disabled'
}
}Source: built-in-policies/policyDefinitions/Monitoring/ApplicationInsightsComponents_NetworkAccessEnabled_Modify.json in Azure/azure-policy, under the MIT licence.
Bylaw