Fix ValueError in az serial-console connect when boot diagnostics storage account is inaccessible#33453
Draft
Copilot wants to merge 2 commits into
Draft
Fix ValueError in az serial-console connect when boot diagnostics storage account is inaccessible#33453Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
…urce group is None When a VM has boot diagnostics configured with an explicit storage account URL, but that storage account is not accessible in the current subscription (e.g., it was deleted or is in a different subscription), resource_group_from_storage_account_name() returns None. The previous code only checked `storage_account is not None` before calling get_properties(), allowing None to be passed as resource_group_name, which caused azure-mgmt-storage to raise ValueError: No value for given attribute. Fix: add `storage_account_resource_group is not None` guard so that when the resource group cannot be determined, get_properties() is skipped and None is returned gracefully (the serial-console command continues without region-specific routing).
Copilot
AI
changed the title
[WIP] Fix ValueError in az serial-console connect command
Fix ValueError in az serial-console connect when boot diagnostics storage account is inaccessible
May 28, 2026
Collaborator
|
serial-console |
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.
Related command
az serial-console connectDescription
az serial-console connectcrashes withValueError: No value for given attributewhen a VM has boot diagnostics configured with an explicit storage account URL that is not accessible in the current subscription (e.g., deleted or cross-subscription).Root cause:
get_storage_account_info()incustom.pyguarded withif storage_account is not Nonebefore callingscf.storage_accounts.get_properties(storage_account_resource_group, storage_account), butstorage_account_resource_groupcan also beNonewhenresource_group_from_storage_account_name()cannot find the account in the subscription. PassingNoneasresource_group_nametoazure-mgmt-storage's serializer raises theValueError.Fix: Added
and storage_account_resource_group is not Noneto the guard. When the resource group is undiscoverable,get_properties()is skipped andNoneis returned — the command proceeds without region-specific routing, matching the managed-storage behavior.Changes:
src/serial-console/azext_serialconsole/custom.py— one-line guard fix inget_storage_account_info()src/serial-console/azext_serialconsole/tests/latest/test_custom_unit.py— new mock-based unit tests covering allget_storage_account_infoandparse_storage_account_urlcode paths, including the regression casesrc/serial-console/HISTORY.rst/setup.py— version bumped to1.0.0b4Testing Guide
Run the new unit tests (no live Azure resources required):
History Notes
[serial-console]
az serial-console connect: FixValueError: No value for given attributecrash when the VM's boot diagnostics storage account is not accessible in the current subscription.This 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.