Skip to content

[Compute] Fix #33556: az vm boot-diagnostics get-boot-log: Fix TypeError with azure-mgmt-storage 25.0.0 - #33872

Open
Pavel Dostál (pdostal) wants to merge 1 commit into
Azure:devfrom
pdostal:fix-vm-boot-log-keys-property-33556
Open

[Compute] Fix #33556: az vm boot-diagnostics get-boot-log: Fix TypeError with azure-mgmt-storage 25.0.0#33872
Pavel Dostál (pdostal) wants to merge 1 commit into
Azure:devfrom
pdostal:fix-vm-boot-log-keys-property-33556

Conversation

@pdostal

@pdostal Pavel Dostál (pdostal) commented Aug 11, 2026

Copy link
Copy Markdown

Related command
az vm boot-diagnostics get-boot-log

Description
Fixes #33556. StorageAccountListKeysResult in azure-mgmt-storage 25.0.0 now inherits from MutableMapping, so .keys resolves to the built-in dict.keys method instead of the renamed keys_property list. This crashed get_boot_log with TypeError: 'method' object is not subscriptable when a VM uses a custom (non-managed) storage account for boot diagnostics. Also fixes the same pattern in the unused _get_private_config helper.

Related to #33727, which addresses the same root cause but additionally adds a keys_property/keys fallback for older azure-mgmt-storage versions and touches batchai/custom.py. Since this repo pins azure-mgmt-storage==25.0.0 exactly (see src/azure-cli/setup.py), that fallback isn't functionally required here, so this PR keeps the fix minimal and scoped to the actual regression.

Testing Guide

# Unit test (no live resources needed)
python -m pytest src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py -k BootLog -v

# Live smoke-test (VM must use a custom storage account for boot diagnostics)
az vm boot-diagnostics get-boot-log --resource-group <rg> --name <vm-name>

History Notes
[Compute] az vm boot-diagnostics get-boot-log: Fix TypeError: 'method' object is not subscriptable when VM uses a custom storage account for boot diagnostics (regression with azure-mgmt-storage 25.0.0)


… TypeError with azure-mgmt-storage 25.0.0

StorageAccountListKeysResult in azure-mgmt-storage 25.0.0 now inherits
from MutableMapping, so `.keys` resolves to the built-in dict.keys
method instead of the renamed `keys_property` list. This crashed
get_boot_log when a VM uses a custom (non-managed) storage account for
boot diagnostics. Also fixes the same pattern in the unused
_get_private_config helper, and adds a unit test covering the
keys_property credential path and the full download flow.

Co-Authored-By: Claude Sonnet 5
@pdostal
Pavel Dostál (pdostal) requested a review from a team as a code owner August 11, 2026 13:13
Copilot AI lite review requested due to automatic review settings August 11, 2026 13:13
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Aug 11, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution Pavel Dostál (@pdostal)! We will review the pull request and get back to you soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a regression in az vm boot-diagnostics get-boot-log caused by azure-mgmt-storage==25.0.0 changing StorageAccountListKeysResult so that .keys resolves to the mapping method instead of the key list, leading to TypeError: 'method' object is not subscriptable for VMs using a custom boot diagnostics storage account.

Changes:

  • Update VM boot log retrieval to use keys_property instead of keys when reading storage account keys.
  • Apply the same fix in the _get_private_config helper.
  • Add a unit test asserting keys_property is used to construct the BlobClient credential.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/azure-cli/azure/cli/command_modules/vm/custom.py Switch storage key access from .keys to .keys_property for list_keys results to avoid the MutableMapping .keys() collision.
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py Add regression unit test validating the boot log path uses keys_property when building the blob client credential.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@pdostal

Copy link
Copy Markdown
Author

Hello Teresa Ritorto (@teresaritorto), can you please advice me if this fix makes sense and who should help me to review it? I'm willing to work on it but I can also drop it in favor of #33727.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-codegen-extensibility-squad act-observability-squad Auto-Assign Auto assign by bot Compute az vm/vmss/image/disk/snapshot customer-reported Issues that are reported by GitHub users external to the Azure organization. Storage az storage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az vm boot-diagnostics get-boot-log: TypeError: 'method' object is not subscriptable with azure-mgmt-storage 25.0.0

3 participants