Skip to content

Commit b1a853d

Browse files
authored
Merge pull request #5 from SnehaGunda/cplogs
Minor updates
2 parents f176821 + 0000714 commit b1a853d

File tree

1 file changed

+42
-30
lines changed

1 file changed

+42
-30
lines changed

articles/cosmos-db/audit-control-plane-logs.md

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,29 @@ ms.author: sngun
1111

1212
# How to audit Azure Cosmos DB control plane operations
1313

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 portal for 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 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.
1515

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.
2023

2124
## 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.
2525

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:
2729

2830
* 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.
2931

3032
* 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.
3133

3234
## Enable diagnostic logs for control plane operations
3335

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 example RegionFailoverStart 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.
3537

3638
Use the following steps to enable logging on control plane operations:
3739

@@ -50,6 +52,7 @@ You can also store the logs in a storage account or stream to an event hub. This
5052
After you turn on logging, use the following steps to track down operations for a specific account:
5153

5254
1. Sign into [Azure portal](https://portal.azure.com).
55+
5356
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:
5457

5558
```kusto
@@ -72,21 +75,26 @@ If you want to debug further, you can identify a specific operation in the **Act
7275

7376
![Use the activity ID and find the operations](./media/audit-control-plane-logs/find-operations-with-activity-id.png)
7477

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+
9098
* SQL Database Updated
9199
* SQL Container Updated
92100
* SQL Database Throughput Updated
@@ -116,6 +124,9 @@ Many operations are tracked at account level
116124
* AzureTable Table Deleted
117125

118126
## Diagnostic log operations
127+
128+
The following are the operation names in diagnostic logs for different operations:
129+
119130
* RegionAddStart, RegionAddComplete
120131
* RegionRemoveStart, RegionRemoveComplete
121132
* AccountDeleteStart, AccountDeleteComplete
@@ -124,17 +135,18 @@ Many operations are tracked at account level
124135
* AccountUpdateStart, AccountUpdateComplete
125136
* VirtualNetworkDeleteStart, VirtualNetworkDeleteComplete
126137
* DiagnosticLogUpdateStart, DiagnosticLogUpdateComplete
138+
139+
For API-specific operations, the operation is named with the following format:
140+
127141
* ApiKind + ApiKindResourceType + OperationType + Start/Complete
128142
* ApiKind + ApiKindResourceType + "Throughput" + operationType + Start/Complete
129143

130-
Ex:
144+
**Example**
145+
131146
* CassandraKeyspacesUpdateStart, CassandraKeyspacesUpdateComplete
132147
* CassandraKeyspacesThroughputUpdateStart, CassandraKeyspacesThroughputUpdateComplete
133148

134-
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
138150

139151
## Next steps
140152

0 commit comments

Comments
 (0)