Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

Is there a specification for interacting with the local CosmosDB emulator instance via the CLI? #17957

Closed CharlieDigital closed 3 years ago

CharlieDigital commented 3 years ago

The documentation for the az cosmosdb sql commands does not seem to include any ability to interact with the local emulator instance.

The earlier command az cosmosdb database command permitted the use of the --key and --url-connection parameter to interact with the local emulator instance.

Is there an equivalent set of parameters/configuration for interacting with local resources?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Wmengmsft, @MehaKaushik, @shurd, @anfeldma-ms.

Issue Details
The documentation for the `az cosmosdb sql` commands does not seem to include any ability to interact with the local emulator instance. The earlier command `az cosmosdb database` command permitted the use of the `--key` and `--url-connection` parameter to interact with the local emulator instance. Is there an equivalent set of parameters/configuration for interacting with local resources? --- #### Document Details ⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.* * ID: 7e20da33-a85d-abf3-88d4-2c9c6d5c1ad9 * Version Independent ID: ac38600c-6df4-5898-4bd7-fe880eb36819 * Content: [az cosmosdb sql container](https://docs.microsoft.com/en-us/cli/azure/cosmosdb/sql/container?view=azure-cli-latest#az_cosmosdb_sql_container_create) * Content Source: [latest/docs-ref-autogen/cosmosdb/sql/container.yml](https://github.com/MicrosoftDocs/azure-docs-cli/blob/master/latest/docs-ref-autogen/cosmosdb/sql/container.yml) * Service: **cosmos-db** * GitHub Login: @rloutlaw * Microsoft Alias: **routlaw**
Author: CharlieDigital
Assignees: -
Labels: `Cosmos`, `Service Attention`
Milestone: -
yonzhan commented 3 years ago

cosmosdb

MehaKaushik commented 3 years ago

The CosmosDB emulator emulates our data plane. CLI is a tool which exposes Control Plane operations. Today emulator doesn't emulate Control Plane features, hence your ask is not feasible.

The deprecated CLI commands which take connection string as input, they did not go through control Plane, which is also the reason they are now deprecated.

I hope this makes sense, let me know if you have any more questions.

CharlieDigital commented 3 years ago

@MehaKaushik I understand your point, but consider that the az storage queue create operation still retains the --connection-string parameter which allows the usage of "UseDevelopmentStorage=true" to connect to the local emulator instance.

While I understand the desire for architectural purity, the CLI loses utility by disconnecting it from the emulator.

Is there no compromise available to the CLI team to support usage for local development?

If there is no compromise available, then the question is what is the alternative for automating/scripting against the local emulator instance? I think this is an important question to ask for teams that are using these commands in scripts to set up a local development environment consistently.

MehaKaushik commented 3 years ago

I understand your point, this is very valuable feedback. I will work with my team to see how and when can we can support this. Unfortunately, I do not have any temporary workaround.

For scripting against local emulator you can use our data plane sdk. You can use the sdk here: https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-sdk-dotnet-standard

or the REST APIs defined here: https://docs.microsoft.com/en-us/rest/api/cosmos-db/

CharlieDigital commented 3 years ago

@MehaKaushik I appreciate the links to the SDK and REST APIs, but for local development, they are simply not a suitable replacement for initializing and resetting the local environments as it requires writing code as opposed to writing commands.

Look forward to see how the CLI team can make this work as it streamlines the configuration of local development environments via simple batch scripts.