Gallery › Network › Azure built-in policies
Cosmos DB should use a virtual network service endpoint
Converted Policy Audit Disabled Mode Indexed Version 1.0.0
This policy audits any Cosmos DB not configured to use a virtual network service endpoint.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONVirtualNetworkServiceEndpoint_CosmosDB_Audit.json · 49 lines
{
"properties": {
"displayName": "Cosmos DB should use a virtual network service endpoint",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy audits any Cosmos DB not configured to use a virtual network service endpoint.",
"metadata": {
"version": "1.0.0",
"category": "Network"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.DocumentDB/databaseAccounts"
},
{
"field": "Microsoft.DocumentDB/databaseAccounts/virtualNetworkRules[*].id",
"exists": "false"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/e0a2b1a3-f7f9-4569-807f-2a9edebdf4d9",
"name": "e0a2b1a3-f7f9-4569-807f-2a9edebdf4d9"
}Bylawe0a2b1a3-f7f9-4569-807f-2a9edebdf4d9.bylaw.ps1 · 31 lines
# Converted from VirtualNetworkServiceEndpoint_CosmosDB_Audit.json by ConvertTo-Bylaw.
Policy 'e0a2b1a3-f7f9-4569-807f-2a9edebdf4d9' {
Properties @{
DisplayName = 'Cosmos DB should use a virtual network service endpoint'
Description = 'This policy audits any Cosmos DB not configured to use a virtual network service endpoint.'
Version = '1.0.0'
Category = 'Network'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.DocumentDB/databaseAccounts' {
Require 'virtualNetworkRules and id are as required' {
Count 'virtualNetworkRules[*]' -Where {
Field id | Must -Exist
} | Must -Not -Be 0
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Network/VirtualNetworkServiceEndpoint_CosmosDB_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw