{Keyvault} Migrate azure-mgmt-keyvault to typespec generated SDK#32419
{Keyvault} Migrate azure-mgmt-keyvault to typespec generated SDK#32419
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
Pull Request Overview
This PR migrates the azure-mgmt-keyvault SDK from version 12.1.0 to 13.0.0, which is a TypeSpec-generated SDK version. The migration includes API compatibility changes and adds output transformers to maintain backward compatibility with CLI users.
Key Changes
- Updated azure-mgmt-keyvault dependency to version 13.0.0 across all platform requirements
- Changed
Permissionsparameter fromkeystokeys_propertythroughout the codebase to match the new SDK API - Added output transformers to convert
keysPropertyback tokeysin CLI output for backward compatibility
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/setup.py | Updated azure-mgmt-keyvault version constraint to 13.0.0 |
| src/azure-cli/requirements.py3.windows.txt | Updated azure-mgmt-keyvault version to 13.0.0 for Windows |
| src/azure-cli/requirements.py3.Linux.txt | Updated azure-mgmt-keyvault version to 13.0.0 for Linux |
| src/azure-cli/requirements.py3.Darwin.txt | Updated azure-mgmt-keyvault version to 13.0.0 for macOS |
| src/azure-cli/azure/cli/command_modules/keyvault/custom.py | Updated API calls to use keys_property parameter and changed get_sdk to get_models; added .result() calls to vault operations (has critical bugs) |
| src/azure-cli/azure/cli/command_modules/keyvault/commands.py | Added transformer functions to vault commands to maintain output backward compatibility |
| src/azure-cli/azure/cli/command_modules/keyvault/_transformers.py | Added new transformer functions to convert keysProperty to keys in output |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
| # so that we don't need to use raw __dict__ directly | ||
| if getattr(obj, "_is_model", False): | ||
| result = {to_camel_case(attr): todict(getattr(obj, attr), post_processor) | ||
| result = {to_camel_case(get_backcompat_attr_name(obj, attr)): todict(getattr(obj, attr), post_processor) |
There was a problem hiding this comment.
It may be better to add annotation why use get_backcompat_attr_name here so that others could get the context quicly in the future.
There was a problem hiding this comment.
That will be too long for code comment. I'll explain here so that others can get the context from PR history.
Background is that after migration to typespec generated SDK, models with keys/values/ ... properties breaks. Take keyvault Permission model as an example
Previous model definition:
class Permission:
keys: [],
secrets: [],
certificates: [],
storage: []New model definition:
class Permission:
keys_property: [],
secrets: [],
certificates: [],
storage: []To keep the original output, azure-core provides new get_backcompat_attr_name func to avoid such keys -> keys_property breaking change
Related command
Description
This PR migrates
azure-mgmt-keyvaultSDK from swagger generated to typespec generated.For such migration, SDK may have several breaking changes:
https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/hybrid_model_migration.md
https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/operation_migration.md
Many issues CLI reported to SDK team are tracked here:
Azure/azure-sdk-for-python#43838
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.