Skip to content

[account] Guard deserializer against None headers during login/account discovery - #9974

Draft
a0x1ab with Copilot wants to merge 2 commits into
mainfrom
copilot/issue-32371-fix-az-login-error
Draft

[account] Guard deserializer against None headers during login/account discovery#9974
a0x1ab with Copilot wants to merge 2 commits into
mainfrom
copilot/issue-32371-fix-az-login-error

Conversation

Copilot AI commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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

Related command

az login (failure surfaced while account/tenant/subscription retrieval runs post-authentication on broker-enabled Windows environments)

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)

  • Have you run python scripts/ci/test_index.py -q locally? (azdev required; see .azure-pipelines/templates/azdev_setup.yml for the install command until azdev==0.2.11b1 is on PyPI)

  • My extension version conforms to the Extension version schema

  • Issue summary

    • az login could fail with argument of type 'NoneType' is not iterable when downstream account-discovery response headers are unexpectedly None in broker-enabled flows.
  • Change made

    • Added a null guard in account extension vendored subscription deserialization so content-type detection does not iterate on None.
    • Behavior now falls back to default JSON handling when headers are absent, instead of throwing a TypeError.
  • Regression coverage

    • Added a focused unit test validating deserialize_from_http_generics(..., headers=None) is handled safely.
# before
if "content-type" in headers:

# after
if headers and "content-type" in headers:

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Jun 22, 2026

Copy link
Copy Markdown
️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi @copilot,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

Copilot AI changed the title [WIP] Fix az login failure on corp-managed devices [account] Guard deserializer against None headers during login/account discovery Jun 22, 2026
Copilot AI requested a review from a0x1ab June 22, 2026 10:10
@yonzhan

yonzhan commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

account

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants