Skip to content

[vm] fix az vm boot-diagnostics get-boot-log TypeError with azure-mgmt-storage 25.0.0 - #33727

Open
Aditya Pujara (a0x1ab) with Copilot wants to merge 12 commits into
devfrom
copilot/fix-boot-log-typeerror
Open

[vm] fix az vm boot-diagnostics get-boot-log TypeError with azure-mgmt-storage 25.0.0#33727
Aditya Pujara (a0x1ab) with Copilot wants to merge 12 commits into
devfrom
copilot/fix-boot-log-typeerror

Conversation

Copilot AI commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests
️✔️ None ️✔️ 130/130

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

Description

In azure-mgmt-storage 25.0.0, StorageAccountListKeysResult now inherits from MutableMapping, causing .keys to shadow the StorageAccountKey list with the built-in MutableMapping.keys() method. The keys list was renamed to keys_property in the regenerated model.

  • vm/custom.py: In get_boot_log, change keys.keys[0].valuekeys.keys_property[0].value when retrieving the storage account credential for a custom (non-managed) boot diagnostics storage account.
  • test_custom_vm_commands.py: Add test_vm_boot_log_uses_keys_property to assert the correct attribute is used when constructing the BlobClient.
TypeError: 'method' object is not subscriptable
  blob_client = BlobClient.from_blob_url(blob_url=blob_uri, credential=keys.keys[0].value)
                                                                        ~~~~~~~~~^^^

Testing Guide

# Unit test (no live resources needed)
python -m unittest azure.cli.command_modules.vm.tests.latest.test_custom_vm_commands.TestVMBootLog -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

[vm] 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)


This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Azure CLI Full Test Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Breaking Change Starting...

Thanks for your contribution!

@azure-pipelines

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

Copilot AI changed the title [WIP] Fix TypeError in get-boot-log for custom storage accounts [vm] fix az vm boot-diagnostics get-boot-log TypeError with azure-mgmt-storage 25.0.0 Jul 14, 2026

@azure-client-tools-agent azure-client-tools-agent Bot 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.

Automated CI Review — PR #33727

CI has 2 failing checks on the current head commit that need to be resolved:

  1. Test Extensions Loading Python314 — failed. See the Azure DevOps run: https://dev.azure.com/azclitools/5147fa83-336e-44ef-bbe0-c86b8ae86cbb/_build/results?buildId=329676
  2. Test Homebrew Formula — failed. Same build: https://dev.azure.com/azclitools/5147fa83-336e-44ef-bbe0-c86b8ae86cbb/_build/results?buildId=329676

71 of 73 completed checks passed; 17 checks are still pending/running.

Note: the issue-sentinel live-test dispatch could not be triggered this round due to a token-permission restriction (403 Resource not accessible) on the automation side — this is unrelated to the PR itself and will be retried automatically once the underlying CI failures above are addressed.

Please investigate the two failing checks above (Test Extensions Loading Python314 and Test Homebrew Formula) and push a fix.


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

@a0x1ab

Copy link
Copy Markdown
Member

Copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33727 (review) and push a fix.


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

Copilot AI commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33727 (review) and pu...

Investigated the two failing checks. Here's what I found:

Test Extensions Loading Python314 and Test Homebrew Formula — These are pre-existing infrastructure failures unrelated to this PR's changes. The same Test Extensions Loading Python314 failure appears in PR #33723 (buildId=329410), which predates this PR. Neither test is affected by changes to function bodies in vm/custom.py.

However, while investigating I found two additional broken .keys usages in the same codebase that would also fail at runtime with azure-mgmt-storage 25.0.0:

  1. vm/custom.py _get_private_config() (line 207): .list_keys(...).keys chained directly — same TypeError: 'method' object is not subscriptable bug. Fixed to .keys_property.

  2. batchai/custom.py _get_storage_account_key() (line 163): not keys_list_result.keys condition — with 25.0.0, .keys is a bound method (always truthy), so this guard never raised the error. Fixed to use .keys_property.

Also added a HISTORY.rst entry for the fix.

Fixes pushed in commit c39c2b9 (original) and Fix additional .keys[] usages broken by azure-mgmt-storage 25.0.0 and update HISTORY.rst.

@azure-client-tools-agent azure-client-tools-agent Bot 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.

❌ CI Failures — Test Mock Needs Update

The following check suites failed:

  • Azure.azure-cli Full Test (Automation Full Test Python312 Profile Latest instance3)
  • Azure.azure-cli Full Test (Automation Full Test Python314 Profile Latest instance3)

Root Cause

batchai/custom.py was correctly updated to use .keys_property instead of .keys, but the corresponding batchai unit test mock was not updated.

In src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py, the helper function _get_mock_storage_accounts_and_keys (line 60) still creates a namedtuple with the old field name:

Keys = collections.namedtuple('Keys', 'keys')   # ← still 'keys', not 'keys_property'

When the code now accesses keys_list_result.keys_property, it gets an AttributeError because the namedtuple only has a keys field.

Fix Required

Update _get_mock_storage_accounts_and_keys in test_batchai_custom.py to use keys_property instead of keys:

# Change this:
Keys = collections.namedtuple('Keys', 'keys')

# To this:
Keys = collections.namedtuple('Keys', 'keys_property')

This aligns the test mock with the updated batchai/custom.py code that now accesses .keys_property (compatible with azure-mgmt-storage >= 25.0.0).


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

@a0x1ab

Copy link
Copy Markdown
Member

Copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33727 (review) and push a fix.


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


# our streamwriter not seekable, so no parallel.
downloader = blob_client.download_blob(max_concurrency=1)
downloader.readinto(BootLogStreamWriter(sys.stdout))

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.

Copilot We are able to get the correct account keys but the command continues to fail. It looks like it is failing to read everything into the stream. Here is the log

The command failed with an unexpected error. Here is the traceback:
unsupported operand type(s) for +=: 'int' and 'NoneType'
Traceback (most recent call last):
File "C:\Users\jaysontai\Code\azure-cli\env\Lib\site-packages\knack\cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "C:\Users\jaysontai\Code\azure-cli\src\azure-cli-core\azure\cli\core\commands_init_.py", line 677, in execute
raise ex
File "C:\Users\jaysontai\Code\azure-cli\src\azure-cli-core\azure\cli\core\commands_init_.py", line 820, in _run_jobs_serially
results.append(self.run_job(expanded_arg, cmd_copy))
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jaysontai\Code\azure-cli\src\azure-cli-core\azure\cli\core\commands_init
.py", line 789, in run_job
result = cmd_copy(params)
File "C:\Users\jaysontai\Code\azure-cli\src\azure-cli-core\azure\cli\core\commands_init
.py", line 335, in call
return self.handler(*args, **kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\jaysontai\Code\azure-cli\src\azure-cli-core\azure\cli\core\commands\command_operation.py", line 120, in handler
return op(**command_args)
File "C:\Users\jaysontai\Code\azure-cli\src\azure-cli\azure\cli\command_modules\vm\custom.py", line 2320, in get_boot_log
downloader.readinto(BootLogStreamWriter(sys.stdout))
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jaysontai\Code\azure-cli\env\Lib\site-packages\azure\storage\blob_download.py", line 811, in readinto
self._current_content_offset += count
TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — that's a separate bug in BootLogStreamWriter. The storage SDK's readinto does self._current_content_offset += stream.write(...), so the target stream's write must return the number of bytes consumed. BootLogStreamWriter.write returned None implicitly.

Fixed in 1af1c81: write now returns len(str_or_bytes) on all paths (including the UnicodeEncodeError fallback, where fewer characters are actually printed but the full chunk has been consumed). Added test_vm_boot_log_writer_returns_written_length covering the normal, non-unicode-shell, and empty-chunk cases, and updated the HISTORY.rst entry.

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.

Copilot This should've been caught by a scenario test. The managed storage scenario should also be tested by a scenario test it doesnt look like it is right now. It just tests that it turns on.

self.cmd('vm boot-diagnostics enable -g {rg} -n {vm}')
self.cmd('vm show -g {rg} -n {vm}', checks=[
self.check('diagnosticsProfile.bootDiagnostics.enabled', True),
self.check('diagnosticsProfile.bootDiagnostics.storageUri', None)
])
self.cmd('vm boot-diagnostics get-boot-log-uris -g {rg} -n {vm} --expire 100', checks=[
self.exists('consoleScreenshotBlobUri'),
self.exists('serialConsoleLogBlobUri')
])
self.cmd('vm boot-diagnostics get-boot-log -g {rg} -n {vm}')

    self.cmd('vm boot-diagnostics enable -g {rg} -n {vm} --storage {sa}')
    self.cmd('vm show -g {rg} -n {vm}', checks=[
        self.check('diagnosticsProfile.bootDiagnostics.enabled', True),
        self.check('diagnosticsProfile.bootDiagnostics.storageUri', '{storage_uri}')
    ])

It doesn't get the diagnostic logs after enabling managed storage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added vm boot-diagnostics get-boot-log to the custom storage path in test_vm_boot_diagnostics (commit 7ab81e6). The scenario test now calls get-boot-log after both enable (managed storage) and enable --storage {sa} (custom storage), so regressions in either path will be caught by live scenario tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added get-boot-log-uris and get-boot-log calls after enabling managed storage in the scenario test. The test now verifies both the managed (no storage URI) and explicit storage account paths end-to-end.

…s offsets

Co-authored-by: JaysonTaiMicrosoft <268525319+JaysonTaiMicrosoft@users.noreply.github.com>
@azure-client-tools-agent

Copy link
Copy Markdown
Contributor

Started a Copilot task using claude-sonnet-4.6 for human feedback at #33727 (comment): https://github.com/Azure/azure-cli/tasks/fcbf8b81-8186-4a19-8de6-6cf289d12024


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

Co-authored-by: JaysonTaiMicrosoft <268525319+JaysonTaiMicrosoft@users.noreply.github.com>
@azure-client-tools-agent

Copy link
Copy Markdown
Contributor

Started a Copilot task using claude-sonnet-4.6 for human feedback at #33727 (comment): https://github.com/Azure/azure-cli/tasks/bcb480c3-3861-4ea4-b12c-39263553c209


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

…diagnostics test

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
@azure-client-tools-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

FAIL (exit 1)

Selectors: test_batchai_custom test_custom_vm_commands test_vm_commands (module)
PR head ref: copilot/fix-boot-log-typeerror
PR head sha: fea8ca5b73411c4e3b48122f114df1c1933bb2b6
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/32091767979

Live-test recordings: 1 regenerated — archived in workflow artifact live-test-pr-33727 (recordings/).

Recording files
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias.yaml
Last 80 lines of azdev output
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_batchai_update_cluster_user_account_settings_using_config PASSED [  6%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_batchai_update_cluster_user_account_settings_using_current_user PASSED [  7%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_batchai_update_cluster_user_account_settings_using_current_user_and_default_ssh_key PASSED [  7%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_batchai_update_file_server_user_account_settings_using_command_line PASSED [  7%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_batchai_update_file_server_user_account_settings_using_command_line_overriding_config PASSED [  7%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_batchai_update_file_server_user_account_settings_using_command_line_when_key_is_path PASSED [  7%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_batchai_update_file_server_user_account_settings_using_config PASSED [  8%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_batchai_update_file_server_user_account_settings_using_current_user PASSED [  8%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_batchai_update_file_server_user_account_settings_using_current_user_and_default_ssh_key PASSED [  8%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_batchai_update_fileserver_user_account_settings_using_command_line_when_key_is_wrong PASSED [  8%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_batchai_update_nodes_information PASSED [  9%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_generate_auto_storage_account_name PASSED [  9%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_get_effective_resource_parameters_when_name_given PASSED [  9%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_get_effective_resource_parameters_when_none_given PASSED [  9%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_get_effective_resource_parameters_when_resource_id_given PASSED [  9%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_get_image_or_die_supported_aliases PASSED [ 10%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_get_image_or_die_unsupported_alias PASSED [ 10%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_get_image_or_die_with_custom_image_but_without_image PASSED [ 10%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_get_image_or_die_with_custom_image_with_version PASSED [ 10%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_get_image_or_die_with_custom_image_without_version PASSED [ 11%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_get_image_or_die_with_invalid_custom_image PASSED [ 11%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_get_image_or_die_with_invalid_spec PASSED [ 11%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_get_image_or_die_with_valid_spec PASSED [ 11%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_is_on_mount_point_no PASSED [ 11%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_is_on_mount_point_yes PASSED [ 12%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_list_setup_task_files_for_cluster_when_cluster_doesnt_support_suffix PASSED [ 12%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_list_setup_task_files_for_cluster_when_cluster_has_not_mount_volumes PASSED [ 12%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_list_setup_task_files_for_cluster_when_no_node_setup PASSED [ 12%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_list_setup_task_files_for_cluster_when_output_not_on_afs_or_bfs PASSED [ 12%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_list_setup_task_files_for_cluster_when_output_not_on_mounts_root PASSED [ 13%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_list_setup_task_files_for_cluster_when_output_on_afs PASSED [ 13%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_list_setup_task_files_for_cluster_when_output_on_bfs PASSED [ 13%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_setup_task_added_to_cluster_without_node_setup PASSED [ 13%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_setup_task_added_to_cluster_without_setup_task PASSED [ 14%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_setup_task_no_output PASSED [ 14%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_setup_task_overwrite PASSED [ 14%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_validate_subnet_no_conflicts PASSED [ 14%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_validate_subnet_no_nfs PASSED [ 14%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_validate_subnet_no_subnet PASSED [ 15%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_validate_subnet_when_conflict PASSED [ 15%]
azure-cli/src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py::TestBatchAICustom::test_validate_subnet_wrong_resource_id PASSED [ 15%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_access_extension_upgrade_info PASSED [ 15%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name PASSED [ 16%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name_when_type_none PASSED [ 16%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_merge_secrets PASSED [ 16%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_falls_back_to_keys PASSED [ 16%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_handle_unicode PASSED [ 16%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_init_storage_sdk PASSED [ 17%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_uses_keys_property PASSED [ 17%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_writer_returns_written_length PASSED [ 17%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias FAILED [ 17%]

=================================== FAILURES ===================================
_________ VMImageListByAliasesScenarioTest.test_vm_image_list_by_alias _________
self = <latest.test_vm_commands.VMImageListByAliasesScenarioTest testMethod=test_vm_image_list_by_alias>

    def test_vm_image_list_by_alias(self):
        result = self.cmd('vm image list --offer ubuntu').get_output_in_json()
        self.assertTrue(len(result) >= 1)
        self.assertEqual(result[-1]['publisher'], 'Canonical')
>       self.assertTrue('lts' in result[-1]['sku'])
E       AssertionError: False is not true

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:58: AssertionError
------------------------------ Captured log call -------------------------------
WARNING  cli.azure.cli.command_modules.vm.custom:custom.py:2742 You are viewing an offline list of images, use --all to retrieve an up-to-date list
- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
=========================== short test summary info ============================
FAILED azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias - self = <latest.test_vm_commands.VMImageListByAliasesScenarioTest testMethod=test_vm_image_list_by_alias>

    def test_vm_image_list_by_alias(self):
        result = self.cmd('vm image list --offer ubuntu').get_output_in_json()
        self.assertTrue(len(result) >= 1)
        self.assertEqual(result[-1]['publisher'], 'Canonical')
>       self.assertTrue('lts' in result[-1]['sku'])
E       AssertionError: False is not true

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:58: AssertionError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
========================= 1 failed, 80 passed in 6.12s =========================

Posted by agent-assist live-test workflow.

@azure-client-tools-agent azure-client-tools-agent Bot 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.

Live Test Result — Failing

The live-test run for this PR failed on an existing test unrelated to the boot-diagnostics fix:

Failed:

  • src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias
    self.assertTrue('lts' in result[-1]['sku'])
    E       AssertionError: False is not true
    
    This asserts the last entry returned by az vm image list --offer ubuntu (served from the offline curated image list) has an 'lts' SKU. The offline image list data appears to have drifted so the last Ubuntu/Canonical entry no longer has lts in its SKU name.

Passed:

  • All 5 TestVMBootLog unit tests (the actual target of this fix) passed:
    test_vm_boot_log_falls_back_to_keys, test_vm_boot_log_handle_unicode,
    test_vm_boot_log_init_storage_sdk, test_vm_boot_log_uses_keys_property,
    test_vm_boot_log_writer_returns_written_length.
  • All test_batchai_custom tests (87 tests) passed.

CI: all required checks passed (0 failed, 0 pending).

Run: https://github.com/Azure/issue-sentinel/actions/runs/32091767979

Please investigate test_vm_image_list_by_alias — it was swept into this live-test run because it lives in the same file (test_vm_commands.py) as the boot-diagnostics tests, but the assertion failure ('lts' not in result[-1]['sku']) looks unrelated to this PR's change and may reflect stale/updated offline VM image list data rather than a regression caused by this fix. If it's confirmed pre-existing/unrelated, update the assertion to match current data or mark it appropriately; otherwise fix any real regression it uncovers.


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

@azure-client-tools-agent

Copy link
Copy Markdown
Contributor

Started a Copilot task using claude-sonnet-4.6 for the automated review at #33727 (review): https://github.com/Azure/azure-cli/tasks/8378409b-8d57-406e-a6b0-1a0782f14080


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

…date order-dependent assertions

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
@azure-client-tools-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

FAIL (exit 1)

Selectors: test_batchai_custom test_custom_vm_commands test_vm_commands (module)
PR head ref: copilot/fix-boot-log-typeerror
PR head sha: 7ec40f8cac2081d1f8aa630bed5df8026b9c26b4
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/32094445105

Live-test recordings: 3 regenerated — archived in workflow artifact live-test-pr-33727 (recordings/).

Recording files
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias.yaml
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias_and_filtered_by_arch.yaml
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_reimage.yaml
Last 80 lines of azdev output
During handling of the above exception, another exception occurred:

self = <latest.test_vm_commands.VmReimageTest testMethod=test_vm_reimage>
resource_group = 'cli_test_vm_reimage_e62l2dsky74smdq5cvmsxcn5qnlkrq25cijhtuhepcrkqnvlsv7zjm6'

    @AllowLargeResponse()
    @ResourceGroupPreparer(name_prefix='cli_test_vm_reimage_')
    def test_vm_reimage(self, resource_group):
    
        self.kwargs.update({
            'vm': 'vm',
            'subnet': 'mysubnet',
            'vnet': 'myvnet',
            'pubip': 'pubip',
        })
    
        # Create a public IP resource with service tag
>       self.cmd('network public-ip create --name {pubip} -g {rg} --ip-tags FirstPartyUsage=/NonProd')

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:82: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in __init__
    self._in_process_execute(cli_ctx, command, expect_failure=expect_failure)
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in _in_process_execute
    raise ex.exception
.venv/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:677: in execute
    raise ex
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:820: in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:797: in _run_job
    result = transform_op(result)
             ^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/network/_format.py:93: in transform_public_ip_create_output
    return {'publicIp': result.result()}
                        ^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py:105: in result
    self.wait(timeout)
.venv/lib/python3.12/site-packages/azure/core/tracing/decorator.py:119: in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py:127: in wait
    raise self._exception
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py:80: in _start
    for polling_method in self._polling_generator:
                          ^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/_create.py:507: in _execute_operations
    yield self.PublicIpAddressOperationGroupCreateOrUpdate(ctx=self.ctx)()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/_create.py:547: in __call__
    return self.on_error(session.http_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <azure.cli.command_modules.network.aaz.latest.network.public_ip._create.Create.PublicIpAddressOperationGroupCreateOrUpdate object at 0x7f7c60a19eb0>
response = <RequestsTransportResponse: 400 Bad Request, Content-Type: application/json; charset=utf-8>

    def on_error(self, response):
        """ handle errors in response
        """
        # raise common http errors
        error_type = self.error_map.get(response.status_code)
        if error_type:
            raise error_type(response=response)
        # raise HttpResponseError
        error_format = self.ctx.get_error_format(self.error_format)
>       raise HttpResponseError(response=response, error_format=error_format)
E       azure.core.exceptions.HttpResponseError: (SubscriptionNotRegisteredForFeature) Subscription /subscriptions/f758ac53-3e63-4317-a956-0997793808d7/resourceGroups//providers/Microsoft.Network/subscriptions/ is not registered for feature Microsoft.Network/AllowBringYourOwnPublicIpAddress required to carry out the requested operation.
E       Code: SubscriptionNotRegisteredForFeature
E       Message: Subscription /subscriptions/f758ac53-3e63-4317-a956-0997793808d7/resourceGroups//providers/Microsoft.Network/subscriptions/ is not registered for feature Microsoft.Network/AllowBringYourOwnPublicIpAddress required to carry out the requested operation.

azure-cli/src/azure-cli-core/azure/cli/core/aaz/_operation.py:327: HttpResponseError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
======================== 1 failed, 82 passed in 13.69s =========================

Posted by agent-assist live-test workflow.

@azure-client-tools-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

FAIL (exit 1)

Selectors: test_batchai_custom test_custom_vm_commands test_vm_commands (module)
PR head ref: copilot/fix-boot-log-typeerror
PR head sha: ff97e2692638d2453ca4c7baab860c5ee696a06c
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/32096027837

Live-test recordings: 3 regenerated — archived in workflow artifact live-test-pr-33727 (recordings/).

Recording files
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias.yaml
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias_and_filtered_by_arch.yaml
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_reimage.yaml
Last 80 lines of azdev output
During handling of the above exception, another exception occurred:

self = <latest.test_vm_commands.VmReimageTest testMethod=test_vm_reimage>
resource_group = 'cli_test_vm_reimage_qj7f5bt7qazoeezutu7z3etmizm3h432r43bemgl5lvhufgu5jvr66u'

    @AllowLargeResponse()
    @ResourceGroupPreparer(name_prefix='cli_test_vm_reimage_')
    def test_vm_reimage(self, resource_group):
    
        self.kwargs.update({
            'vm': 'vm',
            'subnet': 'mysubnet',
            'vnet': 'myvnet',
            'pubip': 'pubip',
        })
    
        # Create a public IP resource with service tag
>       self.cmd('network public-ip create --name {pubip} -g {rg} --ip-tags FirstPartyUsage=/NonProd')

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:82: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in __init__
    self._in_process_execute(cli_ctx, command, expect_failure=expect_failure)
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in _in_process_execute
    raise ex.exception
.venv/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:677: in execute
    raise ex
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:820: in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:797: in _run_job
    result = transform_op(result)
             ^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/network/_format.py:93: in transform_public_ip_create_output
    return {'publicIp': result.result()}
                        ^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py:105: in result
    self.wait(timeout)
.venv/lib/python3.12/site-packages/azure/core/tracing/decorator.py:119: in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py:127: in wait
    raise self._exception
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py:80: in _start
    for polling_method in self._polling_generator:
                          ^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/_create.py:507: in _execute_operations
    yield self.PublicIpAddressOperationGroupCreateOrUpdate(ctx=self.ctx)()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/_create.py:547: in __call__
    return self.on_error(session.http_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <azure.cli.command_modules.network.aaz.latest.network.public_ip._create.Create.PublicIpAddressOperationGroupCreateOrUpdate object at 0x7fb481b96f00>
response = <RequestsTransportResponse: 400 Bad Request, Content-Type: application/json; charset=utf-8>

    def on_error(self, response):
        """ handle errors in response
        """
        # raise common http errors
        error_type = self.error_map.get(response.status_code)
        if error_type:
            raise error_type(response=response)
        # raise HttpResponseError
        error_format = self.ctx.get_error_format(self.error_format)
>       raise HttpResponseError(response=response, error_format=error_format)
E       azure.core.exceptions.HttpResponseError: (SubscriptionNotRegisteredForFeature) Subscription /subscriptions/f758ac53-3e63-4317-a956-0997793808d7/resourceGroups//providers/Microsoft.Network/subscriptions/ is not registered for feature Microsoft.Network/AllowBringYourOwnPublicIpAddress required to carry out the requested operation.
E       Code: SubscriptionNotRegisteredForFeature
E       Message: Subscription /subscriptions/f758ac53-3e63-4317-a956-0997793808d7/resourceGroups//providers/Microsoft.Network/subscriptions/ is not registered for feature Microsoft.Network/AllowBringYourOwnPublicIpAddress required to carry out the requested operation.

azure-cli/src/azure-cli-core/azure/cli/core/aaz/_operation.py:327: HttpResponseError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
======================== 1 failed, 82 passed in 17.93s =========================

Posted by agent-assist live-test workflow.

@azure-client-tools-agent azure-client-tools-agent Bot 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.

Automated CI and Live-Test Review — Failures Found

PR: [vm] fix \az vm boot-diagnostics get-boot-log` TypeError with azure-mgmt-storage 25.0.0(headff97e26`)

Live test (azdev test --live)

  • ❌ Run failed: https://github.com/Azure/issue-sentinel/actions/runs/32096027837
  • The live-test workflow ran the changed test file(s) for this PR against real Azure resources and the job's test step reported failures. The workflow already posted its own detailed comment with the recorded output on this PR — please check that comment for the exact assertion/traceback.

CI checks (3 failed / 20 total)

All other CI checks passed (linter, style, CLA, and the remaining 15 test shards).

Requested action

Please investigate why the vm module's boot-diagnostics get-boot-log fix causes the live test and the two Automation Full Test shards above to fail, fix the regression (or update the affected tests/recordings if the failure is a legitimate behavior change), and push a commit so CI and the live test can be re-run.


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

@azure-client-tools-agent

Copy link
Copy Markdown
Contributor

Started a Copilot task using claude-sonnet-4.6 for the automated review at #33727 (review): https://github.com/Azure/azure-cli/tasks/1a018279-6fbb-4eb4-8148-ee11dd4f5a3a


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

…lback

- Add 4 missing HTTP interactions to test_vm_boot_diagnostics.yaml for
  the custom-storage path (get-boot-log-uris + get-boot-log), fixing
  CI Full Test instance2 playback failures
- Update batchai test mock to include both keys_property and legacy keys
  attributes, ensuring the fallback path is covered

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
@azure-client-tools-agent

Copy link
Copy Markdown
Contributor

Automated sensitive-information remediation ran on this pull request.

  • Detected categories: azure sas token
  • Replaced with typed [REDACTED:category] placeholders in: no PR metadata fields
  • Comment/review owners notified because Agent Assist cannot edit another user's text: none

Agent Assist does not modify source files. The PR creator must remove or replace each suspected value at the linked line:

If a credential was exposed, rotate or revoke it immediately. Detected values are never copied into this comment.

✅ Confirm the finding · ❌ Dispute the finding

GitHub only supports a fixed reaction set, so 👍 represents ✅ and 👎 represents ❌. The bot-created reactions are only poll choices.


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

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 azure-client-tools-agent Pull request commented on or reviewed by Azure Client Tools Agent Compute az vm/vmss/image/disk/snapshot 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

6 participants