Gallery › Mission › Azure built-in policies
Control the use of CosmosDB in Mission Platforms
Converted Initiative Version 1.0.0
This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. This initiative ensures Cosmos DB resources operate securely within logically separated Mission Platform environments by enforcing boundary protection and access controls.
ConvertTo-Bylaw converted this initiative, and proved that the file compiles back to the same definition.
Azure Policy JSONCosmosDBInitiative.json · 142 lines
{
"properties": {
"displayName": "Control the use of CosmosDB in Mission Platforms",
"policyType": "BuiltIn",
"description": "This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. This initiative ensures Cosmos DB resources operate securely within logically separated Mission Platform environments by enforcing boundary protection and access controls.",
"metadata": {
"version": "1.0.0",
"category": "Mission"
},
"version": "1.0.0",
"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"
},
"publicWithIPEffect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
},
"allowedIPRules": {
"type": "Array",
"metadata": {
"displayName": "The list of allowed IP ranges on the IP rules",
"description": "Enable or disable the execution of the policy"
},
"defaultValue": []
},
"privateEndPointEffect": {
"type": "String",
"metadata": {
"displayName": "CosmosDB external private endpoints access effect",
"description": "Specify the access restriction of private endpoints to a CosmosDB effect"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
},
"excludedSubscriptionIDs": {
"type": "Array",
"metadata": {
"description": "The list of excluded Subscription Ids.",
"displayName": "Excluded subscription IDs"
},
"defaultValue": []
}
},
"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.*.*"
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/65e3adf0-0793-4cd2-af1f-134216ad5ce1",
"policyDefinitionReferenceId": "CosmosDBShouldRestrictPublicAccessWithAllowedIPRules",
"definitionVersion": "1.*.*",
"parameters": {
"effect": {
"value": "[parameters('publicWithIPEffect')]"
},
"allowedIPRules": {
"value": "[parameters('allowedIPRules')]"
}
}
},
{
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/ea79b84d-f538-475d-a6ef-7951747a3455",
"policyDefinitionReferenceId": "CosmosDBShouldRestrictExternalPrivateEndPoints",
"definitionVersion": "1.*.*",
"parameters": {
"effect": {
"value": "[parameters('privateEndPointEffect')]"
},
"excludedSubscriptionIDs": {
"value": "[parameters('excludedSubscriptionIDs')]"
}
}
}
],
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policySetDefinitions/8827e48e-f234-408b-9c00-22f6b54c8b79",
"name": "8827e48e-f234-408b-9c00-22f6b54c8b79"
}Bylaw8827e48e-f234-408b-9c00-22f6b54c8b79.bylaw.ps1 · 108 lines
# Converted from CosmosDBInitiative.json by ConvertTo-Bylaw.
Initiative '8827e48e-f234-408b-9c00-22f6b54c8b79' {
Properties @{
DisplayName = 'Control the use of CosmosDB in Mission Platforms'
Description = 'This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. This initiative ensures Cosmos DB resources operate securely within logically separated Mission Platform environments by enforcing boundary protection and access controls.'
Version = '1.0.0'
Category = 'Mission'
PolicyVersion = '1.0.0'
}
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.'
}
Parameter PublicWithIPEffect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Parameter AllowedIPRules @{
Type = 'Array'
Default = @()
DisplayName = 'The list of allowed IP ranges on the IP rules'
Description = 'Enable or disable the execution of the policy'
}
Parameter PrivateEndPointEffect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'CosmosDB external private endpoints access effect'
Description = 'Specify the access restriction of private endpoints to a CosmosDB effect'
}
Parameter ExcludedSubscriptionIDs @{
Type = 'Array'
Default = @()
DisplayName = 'Excluded subscription IDs'
Description = 'The list of excluded Subscription Ids.'
}
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.*.*'
}
PolicyDefinition @{
Id = '65e3adf0-0793-4cd2-af1f-134216ad5ce1'
ReferenceId = 'CosmosDBShouldRestrictPublicAccessWithAllowedIPRules'
Version = '1.*.*'
Parameters = [ordered]@{
effect = (Param PublicWithIPEffect)
allowedIPRules = (Param AllowedIPRules)
}
}
PolicyDefinition @{
Id = 'ea79b84d-f538-475d-a6ef-7951747a3455'
ReferenceId = 'CosmosDBShouldRestrictExternalPrivateEndPoints'
Version = '1.*.*'
Parameters = [ordered]@{
effect = (Param PrivateEndPointEffect)
excludedSubscriptionIDs = (Param ExcludedSubscriptionIDs)
}
}
}Members (10)
- 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
- CosmosDB should restrict public access but allow access from certain IP addresses
- CosmosDB should restrict external private endpoints access
Source: built-in-policies/policySetDefinitions/Mission/CosmosDBInitiative.json in Azure/azure-policy, under the MIT licence.
Bylaw