Gallery › Azure Ai Services › Azure built-in policies
Azure AI Services resources should restrict network access
Converted Policy Audit Deny Disabled Mode Indexed Version 3.3.0
By restricting network access, you can ensure that only allowed networks can access the service. This can be achieved by configuring network rules so that only applications from allowed networks can access the Azure AI service.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONNetworkAcls_Audit.json · 77 lines
{
"properties": {
"displayName": "Azure AI Services resources should restrict network access",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "By restricting network access, you can ensure that only allowed networks can access the service. This can be achieved by configuring network rules so that only applications from allowed networks can access the Azure AI service.",
"metadata": {
"version": "3.3.0",
"category": "Azure Ai Services"
},
"version": "3.3.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "The effect determines what happens when the policy rule is evaluated to match"
}
}
},
"policyRule": {
"if": {
"anyOf": [
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.CognitiveServices/accounts"
},
{
"field": "Microsoft.CognitiveServices/accounts/publicNetworkAccess",
"notEquals": "Disabled"
},
{
"field": "Microsoft.CognitiveServices/accounts/networkAcls.defaultAction",
"notEquals": "Deny"
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.Search/searchServices"
},
{
"field": "Microsoft.Search/searchServices/publicNetworkAccess",
"notEquals": "Disabled"
},
{
"field": "Microsoft.Search/searchServices/networkRuleSet.ipRules[*].value",
"exists": "false"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"3.3.0",
"3.2.0",
"3.1.0",
"3.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/037eea7a-bd0a-46c5-9a66-03aea78705d3",
"name": "037eea7a-bd0a-46c5-9a66-03aea78705d3"
}Bylaw037eea7a-bd0a-46c5-9a66-03aea78705d3.bylaw.ps1 · 43 lines
# Converted from NetworkAcls_Audit.json by ConvertTo-Bylaw.
Policy '037eea7a-bd0a-46c5-9a66-03aea78705d3' {
Properties @{
DisplayName = 'Azure AI Services resources should restrict network access'
Description = 'By restricting network access, you can ensure that only allowed networks can access the service. This can be achieved by configuring network rules so that only applications from allowed networks can access the Azure AI service.'
Version = '3.3.0'
Category = 'Azure Ai Services'
PolicyVersion = '3.3.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'The effect determines what happens when the policy rule is evaluated to match'
}
Resource * {
Require 'type, publicNetworkAccess and networkAcls.defaultAction are as required' {
AnyOf {
Field type | Must -Not -Be 'Microsoft.CognitiveServices/accounts' -IfPresent
Field 'Microsoft.CognitiveServices/accounts/publicNetworkAccess' | Must -Be 'Disabled'
Field 'Microsoft.CognitiveServices/accounts/networkAcls.defaultAction' | Must -Be 'Deny'
}
}
Require 'type, publicNetworkAccess, networkRuleSet.ipRules and 1 more are as required' {
AnyOf {
Field type | Must -Not -Be 'Microsoft.Search/searchServices' -IfPresent
Field 'Microsoft.Search/searchServices/publicNetworkAccess' | Must -Be 'Disabled'
Count 'Microsoft.Search/searchServices/networkRuleSet.ipRules[*]' -Where {
Field value | Must -Exist
} | Must -Not -Be 0
}
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Azure Ai Services/NetworkAcls_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw