Azure Cosmos SDK upgrade for kv store - #3559
Open
ChihweiLHBird wants to merge 14 commits into
Open
Conversation
ChihweiLHBird
commented
Jun 5, 2026
ChihweiLHBird
force-pushed
the
zhiwei/azure-kv-store-sdk-migration
branch
4 times, most recently
from
June 5, 2026 21:01
c54b8f4 to
0ef22f4
Compare
ChihweiLHBird
marked this pull request as ready for review
June 5, 2026 21:02
ChihweiLHBird
marked this pull request as draft
June 5, 2026 21:02
ChihweiLHBird
force-pushed
the
zhiwei/azure-kv-store-sdk-migration
branch
from
June 5, 2026 21:02
0ef22f4 to
047b4d5
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Modernizes the Azure Cosmos-backed key-value store to use newer Azure SDK APIs and adds explicit Azure AD authentication options plus region-aware routing.
Changes:
- Migrates Cosmos DB interactions from older
CollectionClient/document APIs toContainerClientitem APIs with lazy client initialization. - Adds explicit Azure AD credential selection (
auth_type+ optionalclient_id) and optional region configuration for proximity-based routing. - Updates Azure SDK dependency versions and removes the old connection-pooling feature wiring.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| crates/key-value-azure/src/store.rs | Refactors Cosmos client initialization + CRUD/CAS operations to new SDK APIs; adds auth parsing/utilities and unit tests. |
| crates/key-value-azure/src/lib.rs | Extends runtime config with region, auth_type, and client_id; wires them into store construction and exports AzureCredentialKind. |
| crates/key-value-azure/Cargo.toml | Updates Azure SDK dependencies to newer major versions; removes old connection-pooling feature block. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ChihweiLHBird
force-pushed
the
zhiwei/azure-kv-store-sdk-migration
branch
4 times, most recently
from
June 10, 2026 19:31
35982d4 to
198e1a1
Compare
ChihweiLHBird
force-pushed
the
zhiwei/azure-kv-store-sdk-migration
branch
3 times, most recently
from
June 23, 2026 10:10
64546c4 to
b5f6d83
Compare
ChihweiLHBird
force-pushed
the
zhiwei/azure-kv-store-sdk-migration
branch
from
July 18, 2026 06:37
b5f6d83 to
4e6e1ba
Compare
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
….6.0 Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
…S failures and other errors Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
…ne) for missing values Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
ChihweiLHBird
force-pushed
the
zhiwei/azure-kv-store-sdk-migration
branch
from
July 22, 2026 06:45
cc3f18e to
964720e
Compare
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
ChihweiLHBird
marked this pull request as ready for review
July 22, 2026 07:12
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3021.
Summary
Migrates
spin-key-value-azurefrom the legacy Azure Cosmos SDK to the currentazure_data_cosmos 0.37(driver0.6.0) /azure_core 1.0/azure_identity 1.0stack. Reworks client construction and the item/query APIs, keeps account-key auth, and replaces the old ambient-auth path with explicit Azure AD credential selection.What Changed
AccountReference, async container-client init, and SDK-managed routing (RoutingStrategy::ProximityTo); moved CRUD/batch/increment/CAS to the new APIs (getis now aread_itempoint read) and dropped the old custom connection pooling andreqwesttransport setup.default-features = false+key_auth/native_tls/hmac_rustso the Azure stack uses OpenSSL instead of pulling reqwest's aws-lc-rs rustls provider alongside Spin's workspace-pinnedring.auth_type, including user-assigned managed identity byclient_id; account-key auth is unchanged.regionruntime config (defaults toEast US) used as the routing proximity anchor, and account validation atspin up.currentandswap) — to retryable CAS failures, and everything else to hard errors.get-manynow returns(key, none)for missing keys per thewasi:keyvaluebatch contract instead of dropping them.Runtime Config
Existing account-key configuration works unchanged. When
keyis omitted,auth_typeselects the AAD credential:developer_tools(default),managed_identity(optionally withclient_id),workload_identity, orservice_principal(readsAZURE_TENANT_ID/AZURE_CLIENT_ID/AZURE_CLIENT_SECRET). There is no fallback between types. Optionally setregionto bias routing toward the closest replica.