azure-docs icon indicating copy to clipboard operation
azure-docs copied to clipboard

[CosmosDB] Unclear materialized views tutorial

Open CeyssensStef opened this issue 1 year ago • 1 comments

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.

CeyssensStef avatar Jun 01 '23 11:06 CeyssensStef

@CeyssensStef Thank you for your feedback. We will review and make change if appropriate.

Oury-MSFT avatar Jun 01 '23 14:06 Oury-MSFT

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

seesharprun avatar Jun 06 '23 01:06 seesharprun

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

seesharprun avatar Aug 02 '23 18:08 seesharprun