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/audit-control-plane-logs.md
+42-30Lines changed: 42 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,27 +11,29 @@ ms.author: sngun
11
11
12
12
# How to audit Azure Cosmos DB control plane operations
13
13
14
-
Control Plane for Cosmos DB is a RESTful service that enables customers to perform diverse set of operations on the Cosmos DB account. It exposes public resource model (e.g. database account) and exposes various operations to end-users to perform actions on resource model.Control plane operations include changes to the Azure Cosmos account or container. For example, create an Azure Cosmos account, add a region, update throughput, region failover, add a VNet etc. are some of the control plane operations. This article explains how to audit the control plane operations in Azure Cosmos DB. These operations can be done through cli, powershell or portalfor accounts and through cli and ps for containers.
14
+
Control Plane in Azure Cosmos DB is a RESTful service that enables you to perform a diverse set of operations on the Azure Cosmos account. It exposes a public resource model (for example: database, account) and various operations to the endusers to perform actions on the resource model. The control plane operations include changes to the Azure Cosmos account or container. For example, operations such as create an Azure Cosmos account, add a region, update throughput, region failover, add a VNet etc. are some of the control plane operations. This article explains how to audit the control plane operations in Azure Cosmos DB. You can run the control plane operations on Azure Cosmos accounts by using Azure CLI, PowerShell or Azure portal, whereas for containers, use Azure CLI or PowerShell.
15
15
16
-
Couple examples of such scenarios
17
-
• Customer wants to get an alert when firewall rules for Cosmos DB are modified. This is required to catch unauthorized modifications to rules that govern network security of the Cosmos DB account and take quick action.
18
-
• Customer wants to get an alert if a Cosmos DB region is added / removed. Add / remove region has implications on billing, data sovereignty requirements. The alert will help detect an accidental add / remove region on the Cosmos DB account.
19
-
* Customer wants to get more detail from diagnostic log for what was changed for example in case a vnet was changed.
16
+
The following are some example scenarios where auditing control plane operations is helpful:
17
+
18
+
* You want to get an alert when the firewall rules for your Azure Cosmos account are modified. The alert is required to find unauthorized modifications to rules that govern the network security of your Azure Cosmos account and take quick action.
19
+
20
+
* You want to get an alert if a new region is added or removed from your Azure Cosmos account. Adding or removing regions has implications on billing and data sovereignty requirements. This alert will help you detect an accidental addition or removal of region on your account.
21
+
22
+
* You want to get more details from the diagnostic logs on what has changed. For example, a VNet was changed.
20
23
21
24
## Disable key based metadata write access
22
-
23
-
Before you audit the control plane operations in Azure Cosmos DB, disable the key-based metadata write access on your account. When key based metadata write access is disabled, clients connecting to the Azure Cosmos account through account keys are prevented from accessing the account. You can disable write access by setting the `disableKeyBasedMetadataWriteAccess` property to true. After you set this property, changes to any resource can happen from a user with the proper Role-based access control(RBAC) role and credentials. To learn more on how to set this property, see the [Preventing changes from SDKs](role-based-access-control.md#preventing-changes-from-cosmos-sdk) article.
24
-
This implies SDK based changes to throughput, index will not be rejected.
25
25
26
-
Consider the following points when turning off the metadata write access:
26
+
Before you audit the control plane operations in Azure Cosmos DB, disable the key-based metadata write access on your account. When key based metadata write access is disabled, clients connecting to the Azure Cosmos account through account keys are prevented from accessing the account. You can disable write access by setting the `disableKeyBasedMetadataWriteAccess` property to true. After you set this property, changes to any resource can happen from a user with the proper Role-based access control(RBAC) role and credentials. To learn more on how to set this property, see the [Preventing changes from SDKs](role-based-access-control.md#preventing-changes-from-cosmos-sdk) article. After you disable write access, the SDK-based changes to throughput, index will continue to work.
27
+
28
+
Consider the following points when turning off the metadata write access:
27
29
28
30
* Evaluate and ensure that your applications do not make metadata calls that change the above resources (For example, create collection, update throughput, …) by using the SDK or account keys.
29
31
30
32
* Currently, the Azure portal uses account keys for metadata operations and hence these operations will be blocked. Alternatively, use the Azure CLI, SDKs, or Resource Manager template deployments to perform such operations.
31
33
32
34
## Enable diagnostic logs for control plane operations
33
35
34
-
You can enable diagnostic logs for control plane operations by using the Azure portal. Once enabled diagnostic log will record the operation as a pair of Start and Complete events with relevent details. For exampleRegionFailoverStart and RegionFailoverComplete will complete the RegionFailover event as start to end.
36
+
You can enable diagnostic logs for control plane operations by using the Azure portal. After enabling, the diagnostic logs will record the operation as a pair of start and complete events with relevant details. For example, the *RegionFailoverStart* and *RegionFailoverComplete* will complete the region failover event.
35
37
36
38
Use the following steps to enable logging on control plane operations:
37
39
@@ -50,6 +52,7 @@ You can also store the logs in a storage account or stream to an event hub. This
50
52
After you turn on logging, use the following steps to track down operations for a specific account:
51
53
52
54
1. Sign into [Azure portal](https://portal.azure.com).
55
+
53
56
1. Open the **Monitor** tab from the left-hand navigation and then select the **Logs** pane. It opens a UI where you can easily run queries with that specific account in scope. Run the following query to view control plane logs:
54
57
55
58
```kusto
@@ -72,21 +75,26 @@ If you want to debug further, you can identify a specific operation in the **Act
72
75
73
76

74
77
75
-
## Control plane operations for account which are emitted in metrics
76
-
Many operations are tracked at account level
77
-
* Region Added
78
-
* Region Removed
79
-
* Account Deleted
80
-
* Region Failed Over
81
-
* Account Created
82
-
* Virtual Network Deleted
83
-
* Account Network Settings Updated
84
-
* Account Replication Settings
85
-
* Updated Account Keys
86
-
* Account Backup Settings Updated
87
-
* Account Diagnostic Settings Updated
88
-
89
-
## Control plane operations for database or containers emitted in metrics
78
+
## Control plane operations for Azure Cosmos account
79
+
80
+
The following are the control plane operations available at the account level. Most of the operations are tracked at account level. These operations are available as metrics in Azure monitor:
81
+
82
+
* Region added
83
+
* Region removed
84
+
* Account deleted
85
+
* Region failed over
86
+
* Account created
87
+
* Virtual network deleted
88
+
* Account network settings updated
89
+
* Account replication settings updated
90
+
* Account keys updated
91
+
* Account backup settings updated
92
+
* Account diagnostic settings updated
93
+
94
+
## Control plane operations for database or containers
95
+
96
+
The following are the control plane operations available at the database and container level. These operations are available as metrics in Azure monitor:
97
+
90
98
* SQL Database Updated
91
99
* SQL Container Updated
92
100
* SQL Database Throughput Updated
@@ -116,6 +124,9 @@ Many operations are tracked at account level
116
124
* AzureTable Table Deleted
117
125
118
126
## Diagnostic log operations
127
+
128
+
The following are the operation names in diagnostic logs for different operations:
129
+
119
130
* RegionAddStart, RegionAddComplete
120
131
* RegionRemoveStart, RegionRemoveComplete
121
132
* AccountDeleteStart, AccountDeleteComplete
@@ -124,17 +135,18 @@ Many operations are tracked at account level
For the ApiKind operation ResourceDetails contains the hole resource body coming as request payload which will contain all the properties requested to update.
135
-
136
-
137
-
149
+
The *ResourceDetails* property contains the entire resource body as a request payload and it contains all the properties requested to update
0 commit comments