Gallery › Cognitive Services › Azure Landing Zones Library
Enforce recommended guardrails for Open AI (Cognitive Service)
Converted Initiative Version 1.2.0
This policy initiative is a group of policies that ensures Open AI (Cognitive Service) is compliant per regulated Landing Zones.
ConvertTo-Bylaw converted this initiative, and proved that the file compiles back to the same definition.
Azure Policy JSONEnforce-Guardrails-OpenAI.alz_policy_set_definition.json · 238 lines
{
"name": "Enforce-Guardrails-OpenAI",
"properties": {
"description": "This policy initiative is a group of policies that ensures Open AI (Cognitive Service) is compliant per regulated Landing Zones.",
"displayName": "Enforce recommended guardrails for Open AI (Cognitive Service)",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "Cognitive Services",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.2.0"
},
"parameters": {
"azureAiDiagSettings": {
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "AuditIfNotExists",
"type": "string"
},
"azureAiDisableLocalKey": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists",
"type": "string"
},
"azureAiDisableLocalKey2": {
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"defaultValue": "DeployIfNotExists",
"type": "string"
},
"azureAiNetworkAccess": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
},
"azureAiPrivateLink": {
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit",
"type": "string"
},
"cognitiveServicesCustomerStorage": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
},
"cognitiveServicesDisableLocalAuth": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
},
"cognitiveServicesManagedIdentity": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
},
"cognitiveServicesModifyDisableLocalAuth": {
"allowedValues": [
"Modify",
"Disabled"
],
"defaultValue": "Modify",
"type": "string"
},
"cognitiveServicesNetworkAcls": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
},
"cognitiveServicesOutboundNetworkAccess": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"type": "string"
}
},
"policyDefinitions": [
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('cognitiveServicesOutboundNetworkAccess')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/Deny-CognitiveServices-RestrictOutboundNetworkAccess",
"policyDefinitionReferenceId": "Deny-OpenAi-OutboundNetworkAccess"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('cognitiveServicesNetworkAcls')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/Deny-CognitiveServices-NetworkAcls",
"policyDefinitionReferenceId": "Deny-OpenAi-NetworkAcls"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('cognitiveServicesManagedIdentity')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/fe3fd216-4f83-4fc1-8984-2bbec80a3418",
"policyDefinitionReferenceId": "Deny-Cognitive-Services-Managed-Identity"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('cognitiveServicesDisableLocalAuth')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/71ef260a-8f18-47b7-abcb-62d0673d94dc",
"policyDefinitionReferenceId": "Deny-Cognitive-Services-Local-Auth"
},
{
"definitionVersion": "2.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('cognitiveServicesCustomerStorage')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/46aa9b05-0e60-4eae-a88b-1e9d374fa515",
"policyDefinitionReferenceId": "Deny-Cognitive-Services-Cust-Storage"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('cognitiveServicesModifyDisableLocalAuth')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/14de9e63-1b31-492e-a5a3-c3f7fd57f555",
"policyDefinitionReferenceId": "Modify-Cognitive-Services-Local-Auth"
},
{
"definitionVersion": "3.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('azureAiNetworkAccess')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/037eea7a-bd0a-46c5-9a66-03aea78705d3",
"policyDefinitionReferenceId": "Deny-AzureAI-Network-Access"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('azureAiPrivateLink')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/d6759c02-b87f-42b7-892e-71b3f471d782",
"policyDefinitionReferenceId": "Audit-AzureAI-Private-Link"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('azureAiDisableLocalKey')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/d45520cb-31ca-44ba-8da2-fcf914608544",
"policyDefinitionReferenceId": "Dine-AzureAI-Local-Key"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('azureAiDisableLocalKey2')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/55eff01b-f2bd-4c32-9203-db285f709d30",
"policyDefinitionReferenceId": "Dine-AzureAI-Local-Key2"
},
{
"definitionVersion": "1.*.*",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('azureAiDiagSettings')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1b4d1c4e-934c-4703-944c-27c82c06bebb",
"policyDefinitionReferenceId": "Aine-AzureAI-Diag-Settings"
}
],
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policySetDefinitions"
}BylawEnforce-Guardrails-OpenAI.bylaw.ps1 · 166 lines
# Converted from Enforce-Guardrails-OpenAI.alz_policy_set_definition.json by ConvertTo-Bylaw.
Initiative 'Enforce-Guardrails-OpenAI' {
Properties @{
DisplayName = 'Enforce recommended guardrails for Open AI (Cognitive Service)'
Description = 'This policy initiative is a group of policies that ensures Open AI (Cognitive Service) is compliant per regulated Landing Zones.'
Category = 'Cognitive Services'
Version = '1.2.0'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter AzureAiDiagSettings @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
}
Parameter AzureAiDisableLocalKey @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
}
Parameter AzureAiDisableLocalKey2 @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
}
Parameter AzureAiNetworkAccess @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
Parameter AzureAiPrivateLink @{
Type = 'string'
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
}
Parameter CognitiveServicesCustomerStorage @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
Parameter CognitiveServicesDisableLocalAuth @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
Parameter CognitiveServicesManagedIdentity @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
Parameter CognitiveServicesModifyDisableLocalAuth @{
Type = 'string'
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
}
Parameter CognitiveServicesNetworkAcls @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
Parameter CognitiveServicesOutboundNetworkAccess @{
Type = 'string'
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
}
PolicyDefinition @{
Id = '/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/Deny-CognitiveServices-RestrictOutboundNetworkAccess'
ReferenceId = 'Deny-OpenAi-OutboundNetworkAccess'
Version = '1.*.*'
Parameters = @{
effect = (Param CognitiveServicesOutboundNetworkAccess)
}
}
PolicyDefinition @{
Id = '/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/Deny-CognitiveServices-NetworkAcls'
ReferenceId = 'Deny-OpenAi-NetworkAcls'
Version = '1.*.*'
Parameters = @{
effect = (Param CognitiveServicesNetworkAcls)
}
}
PolicyDefinition @{
Id = 'fe3fd216-4f83-4fc1-8984-2bbec80a3418'
ReferenceId = 'Deny-Cognitive-Services-Managed-Identity'
Version = '1.*.*'
Parameters = @{
effect = (Param CognitiveServicesManagedIdentity)
}
}
PolicyDefinition @{
Id = '71ef260a-8f18-47b7-abcb-62d0673d94dc'
ReferenceId = 'Deny-Cognitive-Services-Local-Auth'
Version = '1.*.*'
Parameters = @{
effect = (Param CognitiveServicesDisableLocalAuth)
}
}
PolicyDefinition @{
Id = '46aa9b05-0e60-4eae-a88b-1e9d374fa515'
ReferenceId = 'Deny-Cognitive-Services-Cust-Storage'
Version = '2.*.*'
Parameters = @{
effect = (Param CognitiveServicesCustomerStorage)
}
}
PolicyDefinition @{
Id = '14de9e63-1b31-492e-a5a3-c3f7fd57f555'
ReferenceId = 'Modify-Cognitive-Services-Local-Auth'
Version = '1.*.*'
Parameters = @{
effect = (Param CognitiveServicesModifyDisableLocalAuth)
}
}
PolicyDefinition @{
Id = '037eea7a-bd0a-46c5-9a66-03aea78705d3'
ReferenceId = 'Deny-AzureAI-Network-Access'
Version = '3.*.*'
Parameters = @{
effect = (Param AzureAiNetworkAccess)
}
}
PolicyDefinition @{
Id = 'd6759c02-b87f-42b7-892e-71b3f471d782'
ReferenceId = 'Audit-AzureAI-Private-Link'
Version = '1.*.*'
Parameters = @{
effect = (Param AzureAiPrivateLink)
}
}
PolicyDefinition @{
Id = 'd45520cb-31ca-44ba-8da2-fcf914608544'
ReferenceId = 'Dine-AzureAI-Local-Key'
Version = '1.*.*'
Parameters = @{
effect = (Param AzureAiDisableLocalKey)
}
}
PolicyDefinition @{
Id = '55eff01b-f2bd-4c32-9203-db285f709d30'
ReferenceId = 'Dine-AzureAI-Local-Key2'
Version = '1.*.*'
Parameters = @{
effect = (Param AzureAiDisableLocalKey2)
}
}
PolicyDefinition @{
Id = '1b4d1c4e-934c-4703-944c-27c82c06bebb'
ReferenceId = 'Aine-AzureAI-Diag-Settings'
Version = '1.*.*'
Parameters = @{
effect = (Param AzureAiDiagSettings)
}
}
}Members (11)
- Outbound network access should be restricted for Cognitive Services
- Network ACLs should be restricted for Cognitive Services
- Cognitive Services accounts should use a managed identity
- Azure AI Services resources should have key access disabled (disable local authentication)
- Cognitive Services accounts should use customer owned storage
- Configure Cognitive Services accounts to disable local authentication methods
- Azure AI Services resources should restrict network access
- Azure AI Services resources should use Azure Private Link
- Configure Azure AI Services resources to disable local key access (disable local authentication)
- Configure Azure AI Services resources to disable local key access (disable local authentication)
- Diagnostic logs in Azure AI services resources should be enabled
Source: policy_set_definitions/Enforce-Guardrails-OpenAI.alz_policy_set_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw