You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/policy.md
+28-28Lines changed: 28 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: Azure Policy and Cosmos DB
3
-
description: This article describes how to use Azure Policy to implement governance and controls for Cosmos DB resources.
2
+
title: Use Azure Policy to implement governance and controls for Azure Cosmos DB resources
3
+
description: Learn how to use Azure Policy to implement governance and controls for Cosmos DB resources.
4
4
author: plzm
5
5
ms.author: paelaz
6
6
ms.service: cosmos-db
@@ -9,54 +9,54 @@ ms.date: 05/20/2020
9
9
10
10
---
11
11
12
-
# Azure Policy Overview
12
+
# Use Azure Policy to implement governance and controls for Azure Cosmos DB resources
13
13
14
14
[Azure Policy](../governance/policy/overview.md) helps to enforce organizational governance standards, assess resource compliance, and implement automatic remediation. Common use cases include security, cost management, and configuration consistency.
15
15
16
-
Azure Policy provides built-in policy definitions. Custom policy definitions can be created for scenarios not addressed by built-in policy definitions. Consult [Azure Policy documentation](../governance/policy/overview.md) for specifics.
16
+
Azure Policy provides built-in policy definitions. You can create custom policy definitions for scenarios that are not addressed by the built-in policy definitions. See the [Azure Policy documentation](../governance/policy/overview.md) for more details.
17
17
18
-
## Assigning a Built-in Policy Definition
18
+
## Assign a built-in policy definition
19
19
20
-
Policy _assignments_ are created from policy _definitions_. Built-in or custom policy definitions can be used. Assignments are scoped to an Azure management group, an Azure subscription, or a resource group and will apply to resources within the scope. Optionally, specific resources can be excluded from the scope.
20
+
Policy definitions describe resource compliance conditions and the effect to take if a condition is met. Policy _assignments_ are created from policy _definitions_. You can use built-in or custom policy definitions for your Azure Cosmos DB resources. Policy assignments are scoped to an Azure management group, an Azure subscription, or a resource group and they are applied to the resources within the selected scope. Optionally, you can exclude specific resources from the scope.
21
21
22
-
Policy assignments can be created with the [Azure portal](../governance/policy/assign-policy-portal.md), [Azure PowerShell](../governance/policy/assign-policy-powershell.md), [Azure CLI](../governance/policy/assign-policy-azurecli.md), or [ARM template](../governance/policy/assign-policy-template.md).
22
+
You can create policy assignments with the [Azure portal](../governance/policy/assign-policy-portal.md), [Azure PowerShell](../governance/policy/assign-policy-powershell.md), [Azure CLI](../governance/policy/assign-policy-azurecli.md), or [ARM template](../governance/policy/assign-policy-template.md).
23
23
24
-
To create a policy assignment from a built-in policy definition for Cosmos DB, follow the steps to[create a policy assignment with the Azure portal](../governance/policy/assign-policy-portal.md).
24
+
To create a policy assignment from a built-in policy definition for Azure Cosmos DB, use the steps in[create a policy assignment with the Azure portal](../governance/policy/assign-policy-portal.md) article.
25
25
26
-
At the step to select a policy definition, enter `Cosmos DB` in the Search field to filter the list of available built-in policy definitions. Select one of the available built-in policy definitions, then the**Select**button to continue with policy assignment creation.
26
+
At the step to select a policy definition, enter `Cosmos DB` in the Search field to filter the list of available built-in policy definitions. Select one of the available built-in policy definitions, and then choose**Select** to continue creating the policy assignment.
27
27
28
28
> [!TIP]
29
-
> The built-in policy definition names shown on **Available Definitions**can also be used with Azure PowerShell, Azure CLI, or ARM templates to create policy assignments.
29
+
> You can also use the built-in policy definition names shown in the **Available Definitions**pane with Azure PowerShell, Azure CLI, or ARM templates to create policy assignments.
30
30
31
31
:::image type="content" source="./media/policy/available-definitions.png" alt-text="Search for Cosmos DB built-in policy definitions":::
32
32
33
-
## Creating a Custom Policy Definition
33
+
## Create a custom policy definition
34
34
35
-
For specific scenarios not addressed by built-in policies, [a custom policy definition can be created](../governance/policy/tutorials/create-custom-policy-definition). Policy _assignments_ can be created from either built-in or custom policy _definitions_.
35
+
For specific scenarios that are not addressed by built-in policies, you can create [a custom policy definition](../governance/policy/tutorials/create-custom-policy-definition.md). Later you create a Policy _assignment_from your custom policy _definition_.
36
36
37
37
### Property Types and Property Aliases in Policy Rules
38
38
39
-
The [custom policy definition steps](../governance/policy/tutorials/create-custom-policy-definition)include identifying resource properties and property aliases, which are needed to create policy rules.
39
+
Use the [custom policy definition steps](../governance/policy/tutorials/create-custom-policy-definition)to identify the resource properties and property aliases, which are required to create policy rules.
40
40
41
-
To identify Cosmos DB property aliases, use the namespace `Microsoft.DocumentDB` with one of the methods shown in the custom policy definition steps.
41
+
To identify Azure Cosmos DB specific property aliases, use the namespace `Microsoft.DocumentDB` with one of the methods shown in the custom policy definition steps article.
42
42
43
-
#### Using the Azure CLI:
43
+
#### Use the Azure CLI:
44
44
```azurecli-interactive
45
45
# Login first with az login if not using Cloud Shell
46
46
47
47
# Get Azure Policy aliases for namespace Microsoft.DocumentDB
48
48
az provider show --namespace Microsoft.DocumentDB --expand "resourceTypes/aliases" --query "resourceTypes[].aliases[].name"
49
49
```
50
50
51
-
#### Using Azure PowerShell:
51
+
#### Use Azure PowerShell:
52
52
```azurepowershell-interactive
53
53
# Login first with Connect-AzAccount if not using Cloud Shell
54
54
55
55
# Use Get-AzPolicyAlias to list aliases for Microsoft.DocumentDB namespace
The output of listing Cosmos DB property aliases using one of the methods described above is a list of property alias names. Partial sample Cosmos DB output:
59
+
These commands output the list of property alias names for Azure Cosmos DB property. The following is an excerpt from the output:
60
60
61
61
```json
62
62
[
@@ -73,9 +73,9 @@ The output of listing Cosmos DB property aliases using one of the methods descri
73
73
]
74
74
```
75
75
76
-
Any of these property alias names can be used in [custom policy definition rules](../governance/policy/tutorials/create-custom-policy-definition#policy-rule).
76
+
You can use any of these property alias names in the [custom policy definition rules](../governance/policy/tutorials/create-custom-policy-definition.md#policy-rule).
77
77
78
-
An example policy can check if a Cosmos DB SQL database's provisioned throughput is greater than a maximum allowable limit of 400 RU/s. A custom policy definition would include two rules: one to check for the specific type to check, and one for the specific property of the type. Both rules would use alias names.
78
+
The following is an example policy definition that checks if an Azure Cosmos DB SQL database's provisioned throughput is greater than a maximum allowed limit of 400 RU/s. A custom policy definition includes two rules: one to check for the specific type of property alias, and the second one for the specific property of the type. Both rules use the alias names.
79
79
80
80
```json
81
81
"policyRule": {
@@ -94,26 +94,26 @@ An example policy can check if a Cosmos DB SQL database's provisioned throughput
94
94
}
95
95
```
96
96
97
-
Built-in and custom policy definitions can be used similarly to create policy assignments.
97
+
Custom policy definitions can be used to create policy assignments just like the built-in policy definitions are used.
98
98
99
-
## Policy Compliance
99
+
## Policy compliance
100
100
101
-
After policy assignments are created, Azure Policy evaluates the resources in the assignment's scope. Each resource's _compliance_ with the policy is assessed. The _effect_ specified in the policy is then applied to non-compliant resources.
101
+
After the policy assignments are created, Azure Policy evaluates the resources in the assignment's scope. Each resource's _compliance_ with the policy is assessed. The _effect_ specified in the policy is then applied to non-compliant resources.
102
102
103
-
Compliance results and remediation details can be reviewed in the [Azure portal](../governance/policy/how-to/get-compliance-data#portal) or via the [Azure CLI](../governance/policy/how-to/get-compliance-data#command-line) or [Azure Monitor logs](../governance/policy/how-to/get-compliance-data#azure-monitor-logs).
103
+
You can review the compliance results and remediation details in the [Azure portal](../governance/policy/how-to/get-compliance-data.md#portal) or via the [Azure CLI](../governance/policy/how-to/get-compliance-data.md#command-line) or the [Azure Monitor logs](../governance/policy/how-to/get-compliance-data.md#azure-monitor-logs).
104
104
105
-
Two example policy assignments are shown. One assignment, based on a built-in policy definition, checks that Azure Cosmos DB resources are deployed only to allowed Azure regions. The other assignment is based on a custom policy definition. This assignment checks that provisioned throughput on Azure Cosmos DB resources does not exceed a specified maximum.
105
+
The following screenshot shows two example policy assignments. One assignment is based on a built-in policy definition, which checks that the Azure Cosmos DB resources are deployed only to the allowed Azure regions. The other assignment is based on a custom policy definition. This assignment checks that the provisioned throughput on Azure Cosmos DB resources does not exceed a specified maximum limit.
106
106
107
-
After the policy assignments were deployed, the compliance dashboard shows evaluation results. Note that this can take up to 30 minutes after policy assignment deployment.
107
+
After the policy assignments are deployed, the compliance dashboard shows evaluation results. Note that this can take up to 30 minutes after deploying a policy assignment.
108
108
109
109
The screenshot shows the following compliance evaluation results:
110
110
111
-
- Zero of one Azure Cosmos DB accounts in scope are compliant with the policy assignment to check that resources were deployed to allowed regions
112
-
- One of two Azure Cosmos DB database or collection resources in scope are compliant with the policy assignment to check for provisioned throughput exceeding the specified maximum
111
+
- Zero out of one Azure Cosmos DB accounts in the specified scope are compliant with the policy assignment to check that resources were deployed to allowed regions.
112
+
- One out of two Azure Cosmos DB database or collection resources in the specified scope are compliant with the policy assignment to check for provisioned throughput exceeding the specified maximum limit.
113
113
114
114
:::image type="content" source="./media/policy/compliance.png" alt-text="Search for Cosmos DB built-in policy definitions":::
115
115
116
-
Non-compliant resources can be[remediated with Azure Policy](../governance/policy/how-to/remediate-resources).
116
+
To remediate the non-compliant resources, see the[remediated with Azure Policy](../governance/policy/how-to/remediate-resources) article.
0 commit comments