{Compute} Use the static API version when checking resource existence#32963
{Compute} Use the static API version when checking resource existence#32963
Conversation
❌AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
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>
|
There was a problem hiding this comment.
Pull request overview
Updates VM module resource existence checks (used by az vm create) to prefer the provider’s default API version instead of always picking the latest available version, improving compatibility when “latest” isn’t supported in certain clouds/RPs.
Changes:
- Prefer
default_api_versionfor provider resource types when resolving an ARM API version for existence checks. - Retain existing fallback to non-preview
api_versions(and then anyapi_versions) when no default is available.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| if rt[0].default_api_version: | ||
| return rt[0].default_api_version | ||
| npv = [v for v in rt[0].api_versions if 'preview' not in v.lower()] |
Related command
az vm createDescription
Currently, when checking the existence of certain network resources, we retrieve the latest API version and use it to call the backend service. However, the latest version may not always be available. This change updates the logic to use the static API versions instead.
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.