Skip to content

[CosmosDB] Reclaim the documentdb command namespace#33686

Draft
amatarritamicrosoft wants to merge 1 commit into
Azure:devfrom
amatarritamicrosoft:users/amatarrita/unblock-documentdb
Draft

[CosmosDB] Reclaim the documentdb command namespace#33686
amatarritamicrosoft wants to merge 1 commit into
Azure:devfrom
amatarritamicrosoft:users/amatarrita/unblock-documentdb

Conversation

@amatarritamicrosoft

Copy link
Copy Markdown
Member

Summary

Reclaim the documentdb command namespace by removing the _documentdb_deprecate guard from the cosmosdb command module (src/azure-cli/azure/cli/command_modules/cosmosdb/__init__.py).

Background

Microsoft.DocumentDB was the original resource provider name for what is now Cosmos DB. Years ago the CLI renamed az documentdb to az cosmosdb and added a guard that raises All documentdb commands have been renamed to cosmosdb on every az documentdb ... invocation (registered on EVENT_INVOKER_PRE_PARSE_ARGS, before argument parsing).

That guidance is now stale. The documentdb namespace is required for the new DocumentDB (Microsoft.DocumentDB/mongoClusters) service. Because the guard fires before parsing, even a brand-new provider of az documentdb commands is rejected until it is removed.

Change

  • Remove the _documentdb_deprecate function.
  • Remove its cli_ctx.register_event(EVENT_INVOKER_PRE_PARSE_ARGS, ...) registration.
  • Remove the now-unused from knack.events import EVENT_INVOKER_PRE_PARSE_ARGS import.

Impact

  • az documentdb is no longer blocked (the namespace is free for the new service).
  • az cosmosdb is unaffected — verified az cosmosdb still loads and az cosmosdb create works end-to-end.
  • No tests referenced the guard; the guard was the only usage in the repo.

/cc @necusjz

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Remove the `_documentdb_deprecate` guard (and its EVENT_INVOKER_PRE_PARSE_ARGS
registration and now-unused import) from the cosmosdb command module.

The guard was added years ago when `az documentdb` was renamed to
`az cosmosdb`; it raises `All documentdb commands have been renamed to
cosmosdb` on every `az documentdb ...` invocation, before argument parsing.
That guidance is now stale: the `documentdb` namespace is needed for the new
DocumentDB (Microsoft.DocumentDB/mongoClusters) service. `az cosmosdb` is
unaffected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 1, 2026 06:57
@amatarritamicrosoft amatarritamicrosoft requested a review from a team as a code owner July 1, 2026 06:57
@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Azure CLI Full Test Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Breaking Change Starting...

Thanks for your contribution!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the legacy pre-parse deprecation guard in the cosmosdb command module that previously blocked any az documentdb ... invocation, freeing the documentdb namespace for the new DocumentDB (Microsoft.DocumentDB/mongoClusters) service while leaving az cosmosdb behavior unchanged.

Changes:

  • Removed the _documentdb_deprecate pre-parse handler.
  • Removed the EVENT_INVOKER_PRE_PARSE_ARGS event registration and its import.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@amatarritamicrosoft amatarritamicrosoft marked this pull request as draft July 1, 2026 07:01
@yonzhan

yonzhan commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

CosmosDB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants