Repository navigation
[documentdb] Fix restore authentication and CMK support - #10537
Conversation
Expose Entra and CMK/UAMI options while preserving legacy NativeAuth behavior; add validation and recorded coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 46bb57cf-0490-4f99-a750-27ca921e5d89
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Recordings can retain signed operation-result URL parameters, and the Entra-only, CMK-encrypted restore path lacks service coverage.
2 open issues
What changed in this PR
This PR extends DocumentDB point-in-time restore to support Microsoft Entra-only authentication, customer-managed keys, and user-assigned identities while preserving the legacy NativeAuth payload.
Changes:
- Add restore authentication and encryption options with argument validation.
- Expand payload tests and restore scenarios, and introduce polling-token redaction for recordings.
- Update restore documentation and release metadata to
1.1.0b2.
| File | Description |
|---|---|
src/documentdb/setup.py |
Bumps the extension version to 1.1.0b2. |
src/documentdb/README.md |
Documents authentication, encryption, and restore limitations. |
src/documentdb/HISTORY.rst |
Records the new restore capabilities. |
src/documentdb/azext_documentdb/tests/latest/test_restore_custom.py |
Adds payload, validation, and token-redaction tests. |
src/documentdb/azext_documentdb/tests/latest/test_documentdb.py |
Expands restore scenarios and adds recording sanitization. |
src/documentdb/azext_documentdb/custom.py |
Implements restore options, validation, and request serialization. |
Review effort: Balanced
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Re-record with Azure CLI 2.92 and Key Vault SDK 14.0.1. Redact signed operation-result URLs and cover both polling routes in sanitizer tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 46bb57cf-0490-4f99-a750-27ca921e5d89
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Apply the operation-result URL sanitizer to legacy and Entra restore cassettes without changing recorded service behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 46bb57cf-0490-4f99-a750-27ca921e5d89
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Record restoration from an Entra-only encrypted source without native administrator credentials or authConfig. Verify inherited authentication, CMK and identity while reusing the existing CMK scenario setup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 46bb57cf-0490-4f99-a750-27ca921e5d89
|
/azp run |
|
Commenter does not have sufficient privileges for PR 10537 in repo Azure/azure-cli-extensions |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
Please fix CI issues |
Expose supported PITR target settings without changing omitted-option payloads, with focused help and separate live CLI recordings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 46bb57cf-0490-4f99-a750-27ca921e5d89
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 46bb57cf-0490-4f99-a750-27ca921e5d89
Re-record all three CMK scenarios with Key Vault API 2026-05-15. Preserve strict request matching and verify the full DocumentDB scenario and unit suite. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 46bb57cf-0490-4f99-a750-27ca921e5d89
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
ARM REST API coverage reviewReviewed commit Summary: This covers the principal point-in-time restore scenarios, but it should not be described as complete ARM parity. I did not identify a confirmed payload defect in the newly added restore options. The broader gaps below are predominantly pre-existing and need not all be addressed in this scoped PR. Restore coverageThe serializer covers all request fields used by the official native-auth, Entra-auth, and CMK PITR examples:
The shared CreateOrUpdate schema does not fully encode mode-specific restrictions. The PR's reported REST probes show that several otherwise writable fields are rejected or ignored during PITR. I would not expose server version, compute tier, storage size, shard count, HA, Data API, or network bypass merely to match that shared schema. Those runtime observations are specific to the tested API version and region. Coverage gaps and recommendations
Validation performed
Recommendation: Treat this as a scoped restore enhancement. Before claiming comprehensive coverage, resolve or explicitly track the gaps above and obtain a full playback pass with aligned dependencies. |
About "* Combined playback: not fully completed. The first reproduced failure was a Key Vault client/recording API-version mismatch: the local client requested Thanks for checking. The CMK recordings were generated with azure-mgmt-keyvault==14.1.0 , which uses API version 2026-05-15 . Full playback passed on the reviewed commit, d1cfe7e4f , in CI build 373066: 40 tests and 18 subtests passed on each Python version from 3.10 through 3.14, including all three CMK scenarios. This supports your conclusion that the local failure is a dependency mismatch rather than a restore payload defect. "CMK replica creation remains uncovered (pre-existing). ARM has an explicit CMK geo-replica creation example, but ReplicaCreate hides encryption/identity arguments and serializes neither. Restore CMK support does not complete replica CMK support; this can be a separate follow-up." I will take in a different PR as this is for another command, out of scope for this PR "Entra-only cluster creation remains unavailable through create (pre-existing). The generated create schema unconditionally requires administrator username/password, even when selecting Entra-only authentication. The new scenarios seed Entra-only sources using REST to work around this. Track conditional administrator validation for create, similar to restore." I will take in a different PR as well |
Expose optional resource-root tags after service validation, preserve omitted-option behavior, document rejected preview overrides and existing Private Link paths, and add independent real tags and dual-auth recordings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 46bb57cf-0490-4f99-a750-27ca921e5d89
Keep the target branch index and unrelated upstream changes synchronized without rewriting the reviewed restore commits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 46bb57cf-0490-4f99-a750-27ca921e5d89
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
/azp run |
|
Commenter does not have sufficient privileges for PR 10537 in repo Azure/azure-cli-extensions |
Configure Entra authentication and users after restore. Preserve create/update and CMK coverage, retire explicit Entra restore scenarios, and document the flow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 46bb57cf-0490-4f99-a750-27ca921e5d89
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
[Release] Update index.json for extension [ documentdb-1.1.0b2 ] : https://dev.azure.com/msazure/One/_build/results?buildId=191624581&view=results |


🤖 PR Validation —⚠️ Review suggested
Summary
key encryption in
az documentdb mongocluster restore.--storage-type,--public-network-access, and--tagsparameters. Reuse theexisting generated AAZ argument definitions; update only the custom restore argument
filter and request serializer.
NativeAuth credential-pair checks, Entra-only credential validation, and CMK identity
assignment validation.
overrides without claiming that all source settings are inherited.
dedicated DocumentDB commands or treating public access settings as Private Link setup.
1.1.0b2release entry. Extension previewmetadata and command-level preview annotations are unchanged.
REST contract findings
The shared ARM CreateOrUpdate schema covers multiple creation modes. A writable
property in that schema does not, by itself, establish that PITR accepts or honors an
override. The original full-configuration restore request was rejected by the service.
The following observations come from controlled REST tests using
2026-06-15-previewineastus2; they are not claims about every API version or cloud.Successful cases required a terminal
Succeeded/Readyresponse and the expectedproperty value, not just HTTP 201 admission.
serverVersion,compute,sharding,highAvailability,dataApi,networkBypassModestorage.sizeGbPremiumSSDv2. A storage-size override is not exposed.storage.typePremiumSSDtoPremiumSSDv2succeeded; the reverse direction returned an explicit unsupported-migration error. Exposed through--storage-type.publicNetworkAccessEnabledin the tested restore from aDisabledsource. Exposed through--public-network-access.tags--tags; omission preserves the existing request payload.previewFeatures(GeoReplicas)previewFeaturesis undefined in the PITR-specific request schema. Restore does not expose this override. This does not establish inheritance behavior from an already feature-enabled source.authConfig.allowedModesNativeAuthandMicrosoftEntraIDand the expected native administrator. Entra-only authentication with native administrator credentials returns HTTP 400; the CLI rejects this invalid combination before sending the request.Test coverage
and preservation of the NativeAuth, Entra-only, CMK, and user-assigned identity request shapes.
arguments remain hidden.
combination. Each starts from a
PremiumSSD/Enabledsource and checks therestored cluster's terminal state and exact target settings before cleanup.
scenario checks an exact target map distinct from the source; the dual-auth scenario
checks both modes without relying on their order and verifies the native administrator.
Live CLI results
The three storage/network scenarios below completed successfully using the modified CLI, with
assertions enabled and a separate genuine recording for each scenario.
--storage-typeonlyPremiumSSDv2EnabledSucceeded/Ready--public-network-accessonlyPremiumSSDDisabledSucceeded/ReadyPremiumSSDv2DisabledSucceeded/ReadyEach of these three restored clusters retained 128 GiB and NativeAuth. The recordings contain the
actual restore requests, terminal-state responses, and source/target deletions.
Independent Azure checks confirmed that all three owned resource groups were
deleted after the runs.
The review follow-up adds two more independently recorded CLI scenarios:
--tagsenvironment=restoredandteam=documentdb; the source-only tag is absent. NativeAuth, administrator, and inherited storage configuration are preserved.Succeeded/ReadyMicrosoftEntraIDandNativeAuth, the expected administrator, and matching restore source/time and inherited configuration.Succeeded/ReadyBoth follow-up scenarios passed against the service. Their genuine recordings contain
59 and 58 interactions respectively, including source/target deletion. Independent Azure
checks confirmed both resource groups were removed.
Follow-up validation
scenarios, with assertions enabled and unchanged cassette hashes.
operation values are redacted without fabricating service results or weakening matchers.
authentication interactions, tests, recording integrity, service claims, or documentation.
2026-06-15-previewREST alternatives were verified read-only against a test cluster.Endpoint creation, connection approval, and private DNS setup were not exercised here.
Authentication assertions verify management-plane configuration; these scenarios do not
validate database-document contents or successful data-plane sign-in.