Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az cosmosdb sql container create is missing the url-connection parameter #28000

Open
afrancoc2000 opened this issue Dec 11, 2023 · 4 comments
Open
Labels
Auto-Assign Auto assign by bot CosmosDB az cosmosdb customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.

Comments

@afrancoc2000
Copy link

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.

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Service Attention This issue is responsible by Azure service team. CosmosDB az cosmosdb labels Dec 11, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Dec 11, 2023

Thank you for opening this issue, we will look into it.

@evelyn-ys
Copy link
Member

Can you share the deprecated command and parameter name?

@afrancoc2000
Copy link
Author

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

@dmakogon
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot CosmosDB az cosmosdb customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

4 participants