Gallery › Cognitive Services › Azure built-in policies
Cognitive Services accounts should use customer owned storage
Converted Policy Audit Deny Disabled Mode Indexed Version 2.0.0
Use customer owned storage to control the data stored at rest in Cognitive Services. To learn more about customer owned storage, visit https://aka.ms/cogsvc-cmk.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONUserOwnedStorage_Audit.json · 62 lines
{
"properties": {
"displayName": "Cognitive Services accounts should use customer owned storage",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Use customer owned storage to control the data stored at rest in Cognitive Services. To learn more about customer owned storage, visit https://aka.ms/cogsvc-cmk.",
"metadata": {
"version": "2.0.0",
"category": "Cognitive Services"
},
"version": "2.0.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": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.CognitiveServices/accounts"
},
{
"count": {
"field": "Microsoft.CognitiveServices/accounts/userOwnedStorage[*]"
},
"less": 1
},
{
"count": {
"field": "Microsoft.CognitiveServices/accounts/capabilities[*]",
"where": {
"field": "Microsoft.CognitiveServices/accounts/capabilities[*].name",
"equals": "CustomerManagedStorage"
}
},
"greater": 0
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"2.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/46aa9b05-0e60-4eae-a88b-1e9d374fa515",
"name": "46aa9b05-0e60-4eae-a88b-1e9d374fa515"
}Bylaw46aa9b05-0e60-4eae-a88b-1e9d374fa515.bylaw.ps1 · 35 lines
# Converted from UserOwnedStorage_Audit.json by ConvertTo-Bylaw.
Policy '46aa9b05-0e60-4eae-a88b-1e9d374fa515' {
Properties @{
DisplayName = 'Cognitive Services accounts should use customer owned storage'
Description = 'Use customer owned storage to control the data stored at rest in Cognitive Services. To learn more about customer owned storage, visit https://aka.ms/cogsvc-cmk.'
Version = '2.0.0'
Category = 'Cognitive Services'
PolicyVersion = '2.0.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 'Microsoft.CognitiveServices/accounts' {
When {
Count 'userOwnedStorage[*]' | Must -Be 0
}
Require 'capabilities and name are as required' {
Each 'capabilities[*]' {
Field name | Must -Not -Be 'CustomerManagedStorage'
}
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Cognitive Services/UserOwnedStorage_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw