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
+90-6Lines changed: 90 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,21 +11,31 @@ ms.author: sngun
11
11
12
12
# How to audit Azure Cosmos DB control plane operations
13
13
14
-
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.
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 end users 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
+
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.
15
23
16
24
## Disable key based metadata write access
17
-
18
-
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 only. 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.
19
25
20
-
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:
21
29
22
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.
23
31
24
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.
25
33
26
34
## Enable diagnostic logs for control plane operations
27
35
28
-
You can enable diagnostic logs for control plane operations by using the Azure portal. Use the following steps to enable logging on control plane operations:
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.
37
+
38
+
Use the following steps to enable logging on control plane operations:
29
39
30
40
1. Sign into [Azure portal](https://portal.azure.com) and navigate to your Azure Cosmos account.
31
41
@@ -42,6 +52,7 @@ You can also store the logs in a storage account or stream to an event hub. This
42
52
After you turn on logging, use the following steps to track down operations for a specific account:
43
53
44
54
1. Sign into [Azure portal](https://portal.azure.com).
55
+
45
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:
46
57
47
58
```kusto
@@ -64,7 +75,80 @@ If you want to debug further, you can identify a specific operation in the **Act
64
75
65
76

66
77
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
+
98
+
* SQL Database Updated
99
+
* SQL Container Updated
100
+
* SQL Database Throughput Updated
101
+
* SQL Container Throughput Updated
102
+
* SQL Database Deleted
103
+
* SQL Container Deleted
104
+
* Cassandra Keyspace Updated
105
+
* Cassandra Table Updated
106
+
* Cassandra Keyspace Throughput Updated
107
+
* Cassandra Table Throughput Updated
108
+
* Cassandra Keyspace Deleted
109
+
* Cassandra Table Deleted
110
+
* Gremlin Database Updated
111
+
* Gremlin Graph Updated
112
+
* Gremlin Database Throughput Updated
113
+
* Gremlin Graph Throughput Updated
114
+
* Gremlin Database Deleted
115
+
* Gremlin Graph Deleted
116
+
* Mongo Database Updated
117
+
* Mongo Collection Updated
118
+
* Mongo Database Throughput Updated
119
+
* Mongo Collection Throughput Updated
120
+
* Mongo Database Deleted
121
+
* Mongo Collection Deleted
122
+
* AzureTable Table Updated
123
+
* AzureTable Table Throughput Updated
124
+
* AzureTable Table Deleted
125
+
126
+
## Diagnostic log operations
127
+
128
+
The following are the operation names in diagnostic logs for different operations:
0 commit comments