azure-docs
azure-docs copied to clipboard
[CosmosDB] Unclear materialized views tutorial
After going through the steps to setup materialized views, I ran into a couple of issues.
First of all the following command does not work for me. I'm not sure whether it is just an issue at my side but the command seems to be referencing a parameter $accountId which is not set and is in a strange place.
az rest \ --method PUT \ --uri "https://management.azure.com$accountIdsqlDatabases/";\ URL6="$databaseName/containers/$materializedViewName?api-version=2022-11-15-preview" \ --body @definition.json \ --headers content-type=application/json
After some investigation the following command seems to be working for me.
az rest --method PUT --uri "https://management.azure.com/subscriptions/<subscription>/resourcegroups/<resource-group>/providers/Microsoft.DocumentDB/databaseAccounts/<CosmosDB-account-name>/sqlDatabases/<CosmosDB-database>/containers/<CosmosDB-target-container-name>?api-version=2022-11-15-preview" --body @definition.json --headers content-type=application/json
Then the command was working but the creation of the container failed due to a bug in the documentation for which I opened following PR: [CosmosDB] Fixed bug inside materialized views tutorial
Anybody else having issues with the above documented command?
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: c6ab23a2-a289-c30b-3f61-8f724a08a517
- Version Independent ID: d8810200-7794-3f95-b814-1206b6ae0bfa
- Content: Materialized views (preview) - Azure Cosmos DB for NoSQL
- Content Source: articles/cosmos-db/nosql/materialized-views.md
- Service: cosmos-db
- Sub-service: nosql
- GitHub Login: @AbhinavDAIICT
- Microsoft Alias: abtripathi
@CeyssensStef Thank you for your feedback. We will review and make change if appropriate.
@CeyssensStef, the article is a little confusing because it gives you the option of Portal or CLI. Then, halfway through, it switches to CLI only and assumes you have defined the variables specified earlier in the article.
The accountId
variable would have been defined if you followed the CLI instructions. We'll talk to the article author to either remove the Portal version of the instructions or find another way to get the accountId
shell variable if you enabled the materialized view using the portal.
@CeyssensStef, an extra instruction has been added to this tutorial to resolve the issue. When the changes are merged in, this issue will auto-close.