Skip to content

Commit 19a72d7

Browse files
Merge pull request #252585 from seesharprun/cosmos-pr-fixes
Cosmos DB | Various GitHub issue fixes
2 parents ddb9af2 + d0acd2e commit 19a72d7

9 files changed

+67
-12
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Use the following steps to enable logging on control plane operations:
4646

4747
1. Select **ControlPlaneRequests** for log type and select the **Send to Log Analytics** option.
4848

49+
1. Optionally, send the diagnostic logs to Azure Storage, Azure Event Hubs, Azure Monitor, or a third party.
50+
4951
You can also store the logs in a storage account or stream to an event hub. This article shows how to send logs to log analytics and then query them. After you enable, it takes a few minutes for the diagnostic logs to take effect. All the control plane operations performed after that point can be tracked. The following screenshot shows how to enable control plane logs:
5052

5153
:::image type="content" source="./media/audit-control-plane-logs/enable-control-plane-requests-logs.png" alt-text="Enable control plane requests logging":::

articles/cosmos-db/consistency-levels.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ The exact RTT latency is a function of speed-of-light distance and the Azure net
179179
> [!NOTE]
180180
> The RU/s cost of reads for Local Minority reads are twice that of weaker consistency levels because reads are made from two replicas to provide consistency guarantees for Strong and Bounded Staleness.
181181
182+
> [!NOTE]
183+
> The RU/s cost of reads for the strong and bounded staleness consistency levels consume approximately two times more RUs while performing read operations when compared to that of other relaxed consistency levels.
184+
182185
## <a id="rto"></a>Consistency levels and data durability
183186

184187
Within a globally distributed database environment, there's a direct relationship between the consistency level and data durability in the presence of a region-wide outage. As you develop your business continuity plan, you need to understand the maximum period of recent data updates the application can tolerate losing when recovering after a disruptive event. The time period of updates that you might afford to lose is known as **recovery point objective** (**RPO**).

articles/cosmos-db/how-to-configure-private-endpoints.md

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,46 @@ You can set up Private Link by creating a private endpoint in a virtual network
275275

276276
Use the following code to create a Resource Manager template named *PrivateEndpoint_template.json*. This template creates a private endpoint for an existing Azure Cosmos DB vAPI for NoSQL account in an existing virtual network.
277277

278+
### [Bicep](#tab/arm-bicep)
279+
280+
```bicep
281+
@description('Location for all resources.')
282+
param location string = resourceGroup().location
283+
param privateEndpointName string
284+
param resourceId string
285+
param groupId string
286+
param subnetId string
287+
288+
resource privateEndpoint 'Microsoft.Network/privateEndpoints@2019-04-01' = {
289+
name: privateEndpointName
290+
location: location
291+
properties: {
292+
subnet: {
293+
id: subnetId
294+
}
295+
privateLinkServiceConnections: [
296+
{
297+
name: 'MyConnection'
298+
properties: {
299+
privateLinkServiceId: resourceId
300+
groupIds: [
301+
groupId
302+
]
303+
requestMessage: ''
304+
}
305+
}
306+
]
307+
}
308+
}
309+
310+
output privateEndpointNetworkInterface string = privateEndpoint.properties.networkInterfaces[0].id
311+
```
312+
313+
### [JSON](#tab/arm-json)
314+
278315
```json
279316
{
280-
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
317+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
281318
"contentVersion": "1.0.0.0",
282319
"parameters": {
283320
"location": {
@@ -332,13 +369,17 @@ Use the following code to create a Resource Manager template named *PrivateEndpo
332369
}
333370
```
334371

372+
---
373+
335374
**Define the parameters file for the template**
336375

337376
Create a parameters file for the template, and name it *PrivateEndpoint_parameters.json*. Add the following code to the parameters file:
338377

378+
### [Bicep / JSON](#tab/arm-bicep+arm-json)
379+
339380
```json
340381
{
341-
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
382+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
342383
"contentVersion": "1.0.0.0",
343384
"parameters": {
344385
"privateEndpointName": {
@@ -357,6 +398,8 @@ Create a parameters file for the template, and name it *PrivateEndpoint_paramete
357398
}
358399
```
359400

401+
---
402+
360403
**Deploy the template by using a PowerShell script**
361404

362405
Create a PowerShell script by using the following code. Before you run the script, replace the subscription ID, resource group name, and other variable values with the details for your environment.

articles/cosmos-db/nosql/how-to-manage-consistency.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,17 @@ documentClient = new DocumentClient(new Uri(endpoint), authKey, connectionPolicy
8080
// Override consistency at the request level via request options
8181
RequestOptions requestOptions = new RequestOptions { ConsistencyLevel = ConsistencyLevel.Eventual };
8282

83-
var response = await client.CreateDocumentAsync(collectionUri, document, requestOptions);
83+
var response = await client.ReadDocumentAsync(collectionUri, document, requestOptions);
8484
```
8585

8686
# [.NET SDK V3](#tab/dotnetv3)
8787

8888
```csharp
8989
// Override consistency at the request level via request options
90-
ItemRequestOptions requestOptions = new ItemRequestOptions { ConsistencyLevel = ConsistencyLevel.Strong };
90+
ItemRequestOptions requestOptions = new ItemRequestOptions { ConsistencyLevel = ConsistencyLevel.Eventual };
9191

9292
var response = await client.GetContainer(databaseName, containerName)
93-
.CreateItemAsync(
93+
.ReadItemAsync(
9494
item,
9595
new PartitionKey(itemPartitionKey),
9696
requestOptions);

articles/cosmos-db/nosql/how-to-manage-indexing-policy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ It's optional to specify the order. If not specified, the order is ascending.
227227
"compositeIndexes":[
228228
[
229229
{
230-
"path":"/name",
230+
"path":"/name"
231231
},
232232
{
233-
"path":"/age",
233+
"path":"/age"
234234
}
235235
]
236236
]

articles/cosmos-db/nosql/how-to-use-stored-procedures-triggers-udfs.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ new_item = {
232232
"description":"Pick up strawberries",
233233
"isComplete":False
234234
}
235-
result = container.scripts.execute_stored_procedure(sproc=created_sproc,params=[[new_item]], partition_key=new_id)
235+
result = container.scripts.execute_stored_procedure(sproc=created_sproc,params=[new_item], partition_key=new_id)
236236
```
237237

238238
---
@@ -402,7 +402,8 @@ The following code shows how to call a pretrigger using the Python SDK:
402402
```python
403403
item = {'category': 'Personal', 'name': 'Groceries',
404404
'description': 'Pick up strawberries', 'isComplete': False}
405-
container.create_item(item, {'pre_trigger_include': 'trgPreValidateToDoItemTimestamp'})
405+
406+
result = container.create_item(item, pre_trigger_include='trgPreValidateToDoItemTimestamp')
406407
```
407408

408409
---

articles/cosmos-db/nosql/transactional-batch.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ if (response.IsSuccessStatusCode)
8989
```
9090

9191
> [!IMPORTANT]
92-
> If there's a failure, the failed operation will have a status code of its corresponding error. All the other operations will have a 424 status code (failed dependency). In the example below, the operation fails because it tries to create an item that already exists (409 HttpStatusCode.Conflict). The status code enables one to identify the cause of transaction failure.
92+
> If there's a failure, the failed operation will have a status code of its corresponding error. All the other operations will have a 424 status code (failed dependency). If the operation fails because it tries to create an item that already exists, a status code of 409 (conflict) is returned. The status code enables one to identify the cause of transaction failure.
9393
9494
### [Java](#tab/java)
9595

@@ -136,7 +136,7 @@ if (response.isSuccessStatusCode())
136136
```
137137

138138
> [!IMPORTANT]
139-
> If there's a failure, the failed operation will have a status code of its corresponding error. All the other operations will have a 424 status code (failed dependency). In the example below, the operation fails because it tries to create an item that already exists (409 HttpStatusCode.Conflict). The status code enables one to identify the cause of transaction failure.
139+
> If there's a failure, the failed operation will have a status code of its corresponding error. All the other operations will have a 424 status code (failed dependency). If the operation fails because it tries to create an item that already exists, a status code of 409 (conflict) is returned. The status code enables one to identify the cause of transaction failure.
140140
141141
---
142142

articles/cosmos-db/partitioning-overview.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ If your container could grow to more than a few physical partitions, then you sh
123123

124124
## Use item ID as the partition key
125125

126-
If your container has a property that has a wide range of possible values, it's likely a great partition key choice. One possible example of such a property is the *item ID*. For small read-heavy containers or write-heavy containers of any size, the *item ID* is naturally a great choice for the partition key.
126+
> [!NOTE]
127+
> This section primarily applies to the API for NoSQL. Other APIs, such as the API for Gremlin, do not support the unique identifier as the partition key.
128+
129+
If your container has a property that has a wide range of possible values, it's likely a great partition key choice. One possible example of such a property is the *item ID*. For small read-heavy containers or write-heavy containers of any size, the *item ID* (`/id`) is naturally a great choice for the partition key.
127130

128131
The system property *item ID* exists in every item in your container. You may have other properties that represent a logical ID of your item. In many cases, these IDs are also great partition key choices for the same reasons as the *item ID*.
129132

articles/cosmos-db/scripts/cli/nosql/create.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ This script uses the following commands. Each command in the table links to comm
5151
| [az cosmosdb sql container create](/cli/azure/cosmosdb/sql/container#az-cosmosdb-sql-container-create) | Creates an Azure Cosmos DB for NoSQL container. |
5252
| [az group delete](/cli/azure/resource#az-resource-delete) | Deletes a resource group including all nested resources. |
5353

54+
> [!IMPORTANT]
55+
> Use `az cosmsodb sql database create` to create a NoSQL database. The `az cosmosdb database create` command is deprecated.
56+
5457
## Next steps
5558

5659
For more information on the Azure Cosmos DB CLI, see [Azure Cosmos DB CLI documentation](/cli/azure/cosmosdb).

0 commit comments

Comments
 (0)