Open afrancoc2000 opened 11 months ago
Thank you for opening this issue, we will look into it.
Can you share the deprecated command and parameter name?
Yes of course, this is the old deprecated version of the command https://learn.microsoft.com/en-us/cli/azure/cosmosdb/collection?view=azure-cli-latest#az-cosmosdb-collection-create the param is --url-connection
and can be set to localhost to connect to the Cosmos DB Emulator
Adding a bit of clarity to the issue @afrancoc2000 wrote up: here are the two commands juxtaposed, along with their key differences related to this issue:
Original (now-deprecated) call, which works perfectly with the emulator, but lacks unique-key constraints:
az cosmosdb collection create --uri-connection ...
New call, which works perfectly with unique-key constraints, but lacks URI option:
az cosmosdb sql container create --unique-key-policy ...
So, this particular edge case is specific to using az
to create new containers having unique-key-constraint policies, while testing via emulator. We worked around this with a custom Go-based container-creation command-line tool (using the Go SDK directly) that's called from our setup script, alongside calls to az
, but this isn't the ideal solution, long-term.
Related command az cosmosdb sql container create
Description We have a script that creates the CosmosDB containers for our different environments, but we have to use the previous deprecated az command to be able to create our local testing environment to be able to connect to the CosmosDb Emulator, because the new one doesn't have the option to change the url connection. Lately we came with the need of one of the new features of the new command, to be able to add a unique key to our container, so, we had to swith to an SDK and a custom implementation instead.
Proposed solution Add the url-connection to the new Azure command as the deprecated command had.
Current alternatives Our alternatives right now are using the go SDK and the deprecated command instead.