Bylaw

Gallery › Search › Azure built-in policies

Azure AI Search services should disable public network access

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.1

Disabling public network access improves security by ensuring that your Azure AI Search service is not exposed on the public internet. Creating private endpoints can limit exposure of your Search service. 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 JSONRequirePublicNetworkAccessDisabled_Deny.json · 51 lines
{
  "properties": {
    "displayName": "Azure AI Search services should disable public network access",
    "description": "Disabling public network access improves security by ensuring that your Azure AI Search service is not exposed on the public internet. Creating private endpoints can limit exposure of your Search service. Learn more at: https://aka.ms/azure-cognitive-search/inbound-private-endpoints.",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "metadata": {
      "version": "1.0.1",
      "category": "Search"
    },
    "version": "1.0.1",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Search/searchServices"
          },
          {
            "field": "Microsoft.Search/searchServices/publicNetworkAccess",
            "notEquals": "Disabled"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.1",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/ee980b6d-0eca-4501-8d54-f6290fd512c3",
  "name": "ee980b6d-0eca-4501-8d54-f6290fd512c3"
}
Bylawee980b6d-0eca-4501-8d54-f6290fd512c3.bylaw.ps1 · 28 lines
# Converted from RequirePublicNetworkAccessDisabled_Deny.json by ConvertTo-Bylaw.
Policy 'ee980b6d-0eca-4501-8d54-f6290fd512c3' {

    Properties @{
        DisplayName   = 'Azure AI Search services should disable public network access'
        Description   = 'Disabling public network access improves security by ensuring that your Azure AI Search service is not exposed on the public internet. Creating private endpoints can limit exposure of your Search service. Learn more at: https://aka.ms/azure-cognitive-search/inbound-private-endpoints.'
        Version       = '1.0.1'
        Category      = 'Search'
        PolicyVersion = '1.0.1'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.Search/searchServices' {

        Require 'publicNetworkAccess is Disabled' {
            Field publicNetworkAccess | Must -Be 'Disabled'
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Search/RequirePublicNetworkAccessDisabled_Deny.json in Azure/azure-policy, under the MIT licence.