{Compute} az vm create: Fix API version when fetching virtual network resource#31868
{Compute} az vm create: Fix API version when fetching virtual network resource#31868
az vm create: Fix API version when fetching virtual network resource#31868Conversation
❌AzureCLI-FullTest
|
|
Hi @yanzhudd, |
️✔️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
This PR fixes an API version compatibility issue in the az vm create command when fetching virtual network resources. The resource SDK package upgrade introduced a newer API version (2025-01-01) that is not yet supported by the server side.
- Replaces dynamic API version resolution with a hardcoded version from the network module
- Uses the VirtualNetworkShow command's API version instead of relying on the resource SDK
|
Actually, I need to clarify that, in fact, the _resolve_api_version() method does not use the api-version defined by the resource SDK, but it defaults to using the latest stable api-version responded by the corresponding RP provider. azure-cli/src/azure-cli/azure/cli/command_modules/resource/custom.py Lines 4573 to 4595 in 13a94a6 So this ICM is actually caused by the Network RP provider exposing the currently unsupported api-version 2024-10-01 in advance, it should be a service issue, the Network service team needs to help investigate the root cause of this ICM. You can try running az rest --method get --url /subscriptions/<subscription_id>/providers/Microsoft.Network?api-version=2024-11-01 to reproduce this issue.
|
|
Due to the customer current need for a temporary solution to quickly unblock their business, this PR need to be restored to provide a private package |
However, I’d like to clarify that this issue only occurs when using the resource SDK to fetch the latest API of Network, rather than using the Network SDK package or code-generated clients directly. |
|
replaced by #31945 |


Related command
az vm createDescription
IcM: 656299018
In
az vm createcommand, we rely on the resource SDK package to determine which API version is used when fetching a virtual network resource from the backend. However, the resource package was upgraded in #31449. And the new API version being used is 2025-01-01 which is not yet supported by server side.The error message is:
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.