Gallery › VirtualEnclaves › Azure built-in policies
[Preview]: Control the use of CosmosDB in a Virtual Enclave
Converted Initiative Version 1.0.0-preview Preview
This initiative deploys Azure policies for CosmosDB ensuring boundary protection of this resource while it operates within the logically separated structure of Azure Virtual Enclaves. https://aka.ms/VirtualEnclaves
ConvertTo-Bylaw converted this initiative, and proved that the file compiles back to the same definition.
Azure Policy JSONCosmosDBInitiative.json · 75 lines
{
"properties": {
"displayName": "[Preview]: Control the use of CosmosDB in a Virtual Enclave",
"policyType": "BuiltIn",
"description": "This initiative deploys Azure policies for CosmosDB ensuring boundary protection of this resource while it operates within the logically separated structure of Azure Virtual Enclaves. https://aka.ms/VirtualEnclaves",
"metadata": {
"version": "1.0.0-preview",
"category": "VirtualEnclaves",
"preview": true
},
"version": "1.0.0-preview",
"parameters": {
"maxDaysSinceLastRegeneration": {
"type": "String",
"metadata": {
"displayName": "Maximum number of days allowed since last account key regeneration.",
"description": "Specify the maximum number of days allowed since the last account key regeneration."
},
"defaultValue": "60"
}
},
"policyDefinitions": [
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1f905d99-2ab7-462c-a6b0-f709acca6c8f",
"policyDefinitionReferenceId": "CosmosDBShouldUseCmkForEncryption",
"definitionVersion": "1.*.*"
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/58440f8a-10c5-4151-bdce-dfbaad4a20b7",
"policyDefinitionReferenceId": "CosmosDBShouldUsePrivateLink",
"definitionVersion": "1.*.*"
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/797b37f7-06b8-444c-b1ad-fc62867f335a",
"policyDefinitionReferenceId": "CosmosDBShouldDisablePublicNetworkAccess",
"definitionVersion": "1.*.*"
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/5450f5bd-9c72-4390-a9c4-a7aba4edfdd2",
"policyDefinitionReferenceId": "CosmosDBShouldDisableLocalAuthentication",
"definitionVersion": "1.*.*"
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/dc2d41d1-4ab1-4666-a3e1-3d51c43e0049",
"policyDefinitionReferenceId": "CosmosDBConfigureDisableLocalAuthentication",
"definitionVersion": "1.*.*"
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/9d83ccb1-f313-46ce-9d39-a198bfdb51a0",
"policyDefinitionReferenceId": "CosmosDBShouldRotateAccountKeysOnSchedule",
"definitionVersion": "1.*.*",
"parameters": {
"maxDaysSinceLastRegeneration": {
"value": "[parameters('maxDaysSinceLastRegeneration')]"
}
}
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/da69ba51-aaf1-41e5-8651-607cd0b37088",
"policyDefinitionReferenceId": "CosmosDBShouldConfigureDisablePublicNetworkAccess",
"definitionVersion": "1.*.*"
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/b5f04e03-92a3-4b09-9410-2cc5e5047656",
"policyDefinitionReferenceId": "CosmosDBShouldConfigureAdvancedThreatDetection",
"definitionVersion": "1.*.*"
}
],
"versions": [
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policySetDefinitions/6bd484ca-ae8d-46cf-9b33-e1feef84bfba",
"name": "6bd484ca-ae8d-46cf-9b33-e1feef84bfba"
}Bylaw6bd484ca-ae8d-46cf-9b33-e1feef84bfba.bylaw.ps1 · 65 lines
# Converted from CosmosDBInitiative.json by ConvertTo-Bylaw.
Initiative '6bd484ca-ae8d-46cf-9b33-e1feef84bfba' {
Properties @{
DisplayName = '[Preview]: Control the use of CosmosDB in a Virtual Enclave'
Description = 'This initiative deploys Azure policies for CosmosDB ensuring boundary protection of this resource while it operates within the logically separated structure of Azure Virtual Enclaves. https://aka.ms/VirtualEnclaves'
Version = '1.0.0-preview'
Category = 'VirtualEnclaves'
Preview = $true
PolicyVersion = '1.0.0-preview'
}
Parameter MaxDaysSinceLastRegeneration @{
Default = '60'
DisplayName = 'Maximum number of days allowed since last account key regeneration.'
Description = 'Specify the maximum number of days allowed since the last account key regeneration.'
}
PolicyDefinition @{
Id = '1f905d99-2ab7-462c-a6b0-f709acca6c8f'
ReferenceId = 'CosmosDBShouldUseCmkForEncryption'
Version = '1.*.*'
}
PolicyDefinition -Id '58440f8a-10c5-4151-bdce-dfbaad4a20b7' -ReferenceId 'CosmosDBShouldUsePrivateLink' -Version '1.*.*'
PolicyDefinition @{
Id = '797b37f7-06b8-444c-b1ad-fc62867f335a'
ReferenceId = 'CosmosDBShouldDisablePublicNetworkAccess'
Version = '1.*.*'
}
PolicyDefinition @{
Id = '5450f5bd-9c72-4390-a9c4-a7aba4edfdd2'
ReferenceId = 'CosmosDBShouldDisableLocalAuthentication'
Version = '1.*.*'
}
PolicyDefinition @{
Id = 'dc2d41d1-4ab1-4666-a3e1-3d51c43e0049'
ReferenceId = 'CosmosDBConfigureDisableLocalAuthentication'
Version = '1.*.*'
}
PolicyDefinition @{
Id = '9d83ccb1-f313-46ce-9d39-a198bfdb51a0'
ReferenceId = 'CosmosDBShouldRotateAccountKeysOnSchedule'
Version = '1.*.*'
Parameters = @{
maxDaysSinceLastRegeneration = (Param MaxDaysSinceLastRegeneration)
}
}
PolicyDefinition @{
Id = 'da69ba51-aaf1-41e5-8651-607cd0b37088'
ReferenceId = 'CosmosDBShouldConfigureDisablePublicNetworkAccess'
Version = '1.*.*'
}
PolicyDefinition @{
Id = 'b5f04e03-92a3-4b09-9410-2cc5e5047656'
ReferenceId = 'CosmosDBShouldConfigureAdvancedThreatDetection'
Version = '1.*.*'
}
}Members (8)
- Azure Cosmos DB accounts should use customer-managed keys to encrypt data at rest
- CosmosDB accounts should use private link
- Azure Cosmos DB should disable public network access
- Cosmos DB database accounts should have local authentication methods disabled
- Configure Cosmos DB database accounts to disable local authentication
- Azure Cosmos DB accounts should not exceed the maximum number of days allowed since last account key regeneration.
- Configure CosmosDB accounts to disable public network access
- Deploy Advanced Threat Protection for Cosmos DB Accounts
Source: built-in-policies/policySetDefinitions/VirtualEnclaves/CosmosDBInitiative.json in Azure/azure-policy, under the MIT licence.
Bylaw