Skip to content

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

Description

@mpagot

Describe the bug

az vm boot-diagnostics get-boot-log crashes with TypeError: 'method' object is not subscriptable when the VM uses a custom (non-managed) storage account for boot diagnostics.

The root cause is in azure/cli/command_modules/vm/custom.py in the get_boot_log function:

keys = storage_mgmt_client.storage_accounts.list_keys(rg, storage_account.name)
blob_client = BlobClient.from_blob_url(blob_url=blob_uri, credential=keys.keys[0].value)

In azure-mgmt-storage==25.0.0 (shipped with az CLI 2.87.0), StorageAccountListKeysResult was regenerated with a new base class (_Model) that inherits from MutableMapping. This causes .keys to resolve to the built-in MutableMapping.keys() method instead of the list of StorageAccountKey objects.

The storage account keys list was renamed to keys_property in the new model:

  keys_property: Optional[list["_models.StorageAccountKey"]] = rest_field(
      name="keys", visibility=["read"], original_tsp_name="keys"
  )

Related command

az vm boot-diagnostics get-boot-log

To Reproduce:
az vm boot-diagnostics get-boot-log --resource-group <rg> --name <vm-name>

(VM must use a custom storage account for boot diagnostics, not managed storage)

Errors

ERROR: The command failed with an unexpected error. Here is the traceback:
  ERROR: 'method' object is not subscriptable
  Traceback (most recent call last):
    File ".../knack/cli.py", line 233, in invoke
      cmd_result = self.invocation.execute(args)
    File ".../azure/cli/core/commands/__init__.py", line 677, in execute
      raise ex
    File ".../azure/cli/core/commands/__init__.py", line 820, in _run_jobs_serially
      results.append(self._run_job(expanded_arg, cmd_copy))
    File ".../azure/cli/core/commands/__init__.py", line 789, in _run_job
      result = cmd_copy(params)
    File ".../azure/cli/core/commands/__init__.py", line 335, in __call__
      return self.handler(*args, **kwargs)
    File ".../azure/cli/core/commands/command_operation.py", line 120, in handler
      return op(**command_args)
    File ".../azure/cli/command_modules/vm/custom.py", line 2336, in get_boot_log
      blob_client = BlobClient.from_blob_url(blob_url=blob_uri, credential=keys.keys[0].value)
                                                                           ~~~~~~~~~^^^
  TypeError: 'method' object is not subscriptable
  To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Issue script & Debug output

# az vm --debug boot-diagnostics get-boot-log --ids /subscriptions/<ID>/resourceGroups/<RG>/providers/Microsoft.Compute/virtualMachines/<VM> |& tee /tmp/boot-diagnostics.txt
DEBUG: cli.knack.cli: Command arguments: ['vm', '--debug', 'boot-diagnostics', 'get-boot-log', '--ids', '/subscriptions/<ID>/resourceGroups/<RG>/providers/Microsoft.Compute/virtualMachines/<VM>']
DEBUG: cli.knack.cli: __init__ debug log:
Cannot enable color.
DEBUG: cli.knack.cli: Event: Cli.PreExecute []
DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f8cd0126a20>, <function OutputProducer.on_global_arguments at 0x7f8cd00b2980>, <function CLIQuery.on_global_arguments at 0x7f8cd00f0360>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
DEBUG: cli.azure.cli.core: Using packaged command index for profile 'latest'.
DEBUG: cli.azure.cli.core: Modules found from index for 'vm': ['azure.cli.command_modules.vm']
DEBUG: cli.azure.cli.core: Loading command modules...
DEBUG: cli.azure.cli.core: Loaded command modules in parallel:
DEBUG: cli.azure.cli.core: Name                  Load Time    Groups  Commands
DEBUG: cli.azure.cli.core: vm                        0.255        61       224
DEBUG: cli.azure.cli.core: Total (1)                 0.260        61       224
DEBUG: cli.azure.cli.core: Loaded 61 groups, 224 commands.
DEBUG: cli.azure.cli.core: Found a match in the command group table for 'vm'.
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f8ccfcf1f80>]
DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/root/.azure/commands/2026-06-15.12-35-12.vm.7023.log'.
INFO: az_command_data_logger: command args: vm --debug {} {} --ids {}
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7f8ccfd05bc0>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7f8ccf903ce0>, <function register_global_policy_argument.<locals>.add_global_policy_argument at 0x7f8ccf903e20>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7f8ccf903ec0>, <function register_upcoming_breaking_change_info.<locals>.update_breaking_change_info at 0x7f8ccf903f60>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
DEBUG: cli.azure.cli.core.command_recommender: "--ids" is an invalid parameter for command "vm boot-diagnostics get-boot-log".
DEBUG: cli.azure.cli.core.azclierror: NoneType: None
ERROR: cli.azure.cli.core.azclierror: 'get-boot-log' is misspelled or not recognized by the system.
ERROR: az_command_data_logger: 'get-boot-log' is misspelled or not recognized by the system.
Did you mean 'get-boot-log-uris' ?
https://aka.ms/cli_ref
Read more about the command in reference docs
DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f8ccfcf2200>]
INFO: az_command_data_logger: exit code: 2
INFO: cli.__main__: Command ran in 0.364 seconds (init: 0.075, invoke: 0.289)
INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
INFO: telemetry.client: Accumulated 0 events. Flush the clients.
INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
INFO: telemetry.save: Save telemetry record of length 4121 in cache
INFO: telemetry.main: Begin creating telemetry upload process.
INFO: telemetry.process: Creating upload process: "/root/.venv_az/bin/python3.11 /root/.venv_az/lib/python3.11/site-packages/azure/cli/telemetry/__init__.py /root/.azure"
INFO: telemetry.process: Return from creating process
INFO: telemetry.main: Finish creating telemetry upload process.

Expected behavior

I expect the command to print boot log on the stdin

# az vm boot-diagnostics get-boot-log --ids /subscriptions/<ID>/resourceGroups/<RG_NAME>/providers/Microsoft.Compute/virtualMachines/<VM_NAME> 

1    0      Booting `SLES-SAP-16.0'


Loading Linux 6.12.0-160000.32-default ...

Loading initial ramdisk ...

[    0.000000][    T0] Linux version 6.12.0-160000.32-default (geeko@buildhost) (gcc-13 (SUSE Linux) 13.4.0, GNU ld (GNU Binutils; SUSE Linux 16) 2.45.0.20251103-1600001) #1 SMP PREEMPT_DYNAMIC Fri May 15 19:14:55 UTC 2026 (78b265d)

Environment Summary

# az --version; echo QNKip-$?-
azure-cli                         2.87.0
core                              2.87.0
telemetry                          1.1.0
Dependencies:
msal                              1.36.0
azure-mgmt-resource               24.0.0
Python location '/root/.venv_az/bin/python3.11'
Config directory '/root/.azure'
Extensions directory '/root/.azure/cliextensions'
Python (Linux) 3.11.15 (main, Apr 18 2026, 22:55:21) [GCC]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.

Additional context

The root cause seems to me in azure/cli/command_modules/vm/custom.py in the get_boot_log function:

keys = storage_mgmt_client.storage_accounts.list_keys(rg, storage_account.name)
blob_client = BlobClient.from_blob_url(blob_url=blob_uri, credential=keys.keys[0].value)

In azure-mgmt-storage==25.0.0 (shipped with az CLI 2.87.0), StorageAccountListKeysResult was regenerated with a new base class (_Model) that inherits from MutableMapping. This causes .keys to resolve to the built-in MutableMapping.keys() method instead of the list of StorageAccountKey objects.

The storage account keys list was renamed to keys_property in the new model:

  keys_property: Optional[list["_models.StorageAccountKey"]] = rest_field(
      name="keys", visibility=["read"], original_tsp_name="keys"
  )

Activity

  1. added
    bugThis issue requires a change to an existing behavior in the product in order to be resolved.
    on Jun 15, 2026
  2. yonzhan commented on Jun 15, 2026

    @yonzhan
    Collaborator

    Thank you for opening this issue, we will look into it.

  3. added
    Azure CLI TeamThe command of the issue is owned by Azure CLI team
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    and removed
    bugThis issue requires a change to an existing behavior in the product in order to be resolved.
    on Jun 15, 2026
  4. added this to the Backlog milestone on Jun 15, 2026
  5. mpagot commented on Jun 16, 2026

    @mpagot
    Author

    I think it is a bug not a question

  6. added
    bugThis issue requires a change to an existing behavior in the product in order to be resolved.
    and removed on Jul 14, 2026
  7. x-engineering-agent commented on Jul 14, 2026

    @x-engineering-agent
    Contributor

    Bug Analysis

    az vm boot-diagnostics get-boot-log fails with TypeError: 'method' object is not subscriptable when the VM uses a custom (non-managed) storage account for boot diagnostics.

    Root cause: In azure/cli/command_modules/vm/custom.py, the get_boot_log function does:

    keys = storage_mgmt_client.storage_accounts.list_keys(rg, storage_account.name)
    blob_client = BlobClient.from_blob_url(blob_url=blob_uri, credential=keys.keys[0].value)

    With azure-mgmt-storage==25.0.0 (shipped with az CLI 2.87.0), StorageAccountListKeysResult was regenerated with a new base class (_Model) that inherits from MutableMapping. This makes .keys resolve to the built-in MutableMapping.keys() method instead of the list of StorageAccountKey objects. The keys list was renamed to keys_property in the new model:

    keys_property: Optional[list["_models.StorageAccountKey"]] = rest_field(
        name="keys", visibility=["read"], original_tsp_name="keys"
    )

    Fix: Update get_boot_log in azure/cli/command_modules/vm/custom.py to use keys.keys_property[0].value instead of keys.keys[0].value (or otherwise access the keys in a way compatible with the new SDK model). Please also check for any other similarly-affected .keys[...] usages of StorageAccountListKeysResult elsewhere in the vm module, and add/update a unit test covering get_boot_log with a custom storage account.

    Use this EXACT PR title: [VM] Fix #33556: az vm boot-diagnostics get-boot-log: fix TypeError accessing storage account keys with azure-mgmt-storage 25.0.0

    PR title & description format (required)

    This repo enforces a PR format (guide). Please author the PR exactly as follows or CI's Check the Format of Pull Request Title and Content will fail.

    Use this EXACT PR title (copy verbatim, do not reword):

    [VM] Fix #33556: `az vm boot-diagnostics get-boot-log`: fix TypeError accessing storage account keys with azure-mgmt-storage 25.0.0
    

    Keep the backticks around the command and the Fix #33556: prefix. You may only adjust the wording after the command (the final summary) if the fix changes; the [VM] prefix, issue link, and backticked command must stay.

    Description — follow the PR template and fill in:

    • Link the issue — start the Description with a closing keyword so the PR auto-links and closes it: Fixes #33556.
    • Related command — the az ... command this affects.
    • Description (mandatory) — why the bug happens, what you changed, and the resulting behavior.
    • Testing Guide — example command(s) showing the fix works.
    • History Notes — leave the title to drive the history note, or add extra lines in the same format (component in brackets + the command in backticks), e.g. [VM] `az <command>`: <note>.
    • Keep the template checklist and tick the items you've satisfied.

    Posted by agent-assist (autonomous bug-fix pipeline).

  8. removed
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    on Jul 14, 2026
  9. added a commit that references this issue on Aug 25, 2026
    f82b3bb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Azure CLI TeamThe command of the issue is owned by Azure CLI teamRequest X Engineering AgentRequest X Engineering Agent testing and reviewbugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions