Gallery › Search › Azure built-in policies
Configure Azure AI Search services to disable public network access
Converted Policy Disabled Modify Mode Indexed Version 1.0.1
Disable public network access for your Azure AI Search service so that it is not accessible over the public internet. This can reduce data leakage risks. Learn more at: https://aka.ms/azure-cognitive-search/inbound-private-endpoints.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONPublicNetworkAccessDisabled_Modify.json · 64 lines
{
"properties": {
"displayName": "Configure Azure AI Search services to disable public network access",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Disable public network access for your Azure AI Search service so that it is not accessible over the public internet. This can reduce data leakage risks. Learn more at: https://aka.ms/azure-cognitive-search/inbound-private-endpoints.",
"metadata": {
"category": "Search",
"version": "1.0.1"
},
"version": "1.0.1",
"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.Search/searchServices"
},
{
"field": "Microsoft.Search/searchServices/publicNetworkAccess",
"notEquals": "Disabled"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"conflictEffect": "audit",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/4d97b98b-1d4f-4787-a291-c67834d212e7",
"/providers/Microsoft.Authorization/roleDefinitions/7ca78c08-252a-4471-8644-bb5ff32d4ba0"
],
"operations": [
{
"operation": "addOrReplace",
"field": "Microsoft.Search/searchServices/publicNetworkAccess",
"value": "Disabled"
}
]
}
}
},
"versions": [
"1.0.1",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/9cee519f-d9c1-4fd9-9f79-24ec3449ed30",
"name": "9cee519f-d9c1-4fd9-9f79-24ec3449ed30"
}Bylaw9cee519f-d9c1-4fd9-9f79-24ec3449ed30.bylaw.ps1 · 30 lines
# Converted from PublicNetworkAccessDisabled_Modify.json by ConvertTo-Bylaw.
Policy '9cee519f-d9c1-4fd9-9f79-24ec3449ed30' {
Properties @{
DisplayName = 'Configure Azure AI Search services to disable public network access'
Description = 'Disable public network access for your Azure AI Search service so that it is not accessible over the public internet. This can reduce data leakage risks. Learn more at: https://aka.ms/azure-cognitive-search/inbound-private-endpoints.'
Category = 'Search'
Version = '1.0.1'
PolicyVersion = '1.0.1'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Search/searchServices' {
Require 'publicNetworkAccess is Disabled' {
Field publicNetworkAccess | Must -Be 'Disabled'
}
}
Modify -Role 'Network Contributor', 'Search Service Contributor' -ConflictEffect Audit -Effect (Param Effect) {
Field publicNetworkAccess | AddOrReplace 'Disabled'
}
}Source: built-in-policies/policyDefinitions/Search/PublicNetworkAccessDisabled_Modify.json in Azure/azure-policy, under the MIT licence.
Bylaw