Skip to content

az login and az account set fail with HTML-encoded characters and subscription not found #32324

Description

Describe the bug

When using Azure CLI on macOS with zsh, commands like az account set fail due to HTML-encoded characters like < and > being interpreted literally.

Also, even after successful login and selecting the correct subscription, Terraform fails to detect the subscription ID, and Azure CLI shows:

Related command

az login
az account list
az account set --subscription "<SUBSCRIPTION_ID>"

Errors

zsh: no such file or directory: SUBSCRIPTION_ID
The subscription of '<subscription_id>' doesn't exist in cloud 'AzureCloud'.
zsh: missing end of string

Issue script & Debug output

az login --debug
az account set --subscription "" --debug

Expected behavior

Azure CLI should correctly parse and set the subscription ID. HTML-encoded characters should not appear in the terminal. Terraform should be able to detect the subscription ID from the Azure CLI session.

Environment Summary

az --version

Additional context

Using macOS with zsh. Commands copied from web sources seem to include HTML-encoded characters like &lt; instead of <, which causes parsing issues.

Activity

  1. added
    bugThis issue requires a change to an existing behavior in the product in order to be resolved.
    on Oct 26, 2025
  2. yonzhan commented on Oct 26, 2025

    @yonzhan
    Collaborator

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

  3. added
    customer-reportedIssues that are reported by GitHub users external to the Azure organization.
    ARMaz resource/group/lock/tag/deployment/policy/managementapp/account management-group
    on Oct 26, 2025
  4. 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
    Accountaz login/account
    on Oct 26, 2025
  5. removed
    bugThis issue requires a change to an existing behavior in the product in order to be resolved.
    on Oct 26, 2025
  6. added this to the Backlog milestone on Oct 26, 2025
  7. Solutionpoint-blip commented on Oct 26, 2025

    @Solutionpoint-blip
    Author

    Hi Yong Zhang (@yonzhan) and Azure CLI team,
    Thank you for acknowledging the issue.
    I’m currently using macOS with the zsh shell, and I’ve noticed that when copying commands from web sources or documentation, they often include HTML-encoded characters like <SUBSCRIPTION_ID> instead of the correct <SUBSCRIPTION_ID>. This causes parsing errors in both zsh and Terraform, especially when setting environment variables or executing CLI commands.
    For example:
    ShellSUB="<SUBSCRIPTION_ID>" # ❌ FailsSUB="<SUBSC
    SUB="<SUBSCRIPTION_ID>" # ❌ Fails
    SUB="<SUBSCRIPTION_ID>" # ✅ Works correctly

    This behavior leads to failures in commands such as az account set --subscription, which expects a properly formatted subscription ID.
    Suggestion:

    Add a note in the documentation warning users about HTML encoding issues when copying commands.
    Sanitize CLI examples to ensure they are copy-paste friendly across different environments.

    Environment details:

    Azure CLI: 2.78.0
    Python: 3.13.9
    Tenant: D P Printing And Binding
    Subscription: Azure subscription 1

    Please let me know if you need any logs or further reproduction steps. I’ll be happy to assist.
    Thanks again!
    – Solutionpoint-blip

    Let me know if you'd like to include screenshots or logs with this comment.
    Provide your feedback on BizChat

  8. jiasli commented on Oct 29, 2025

    @jiasli
    Contributor

    The &lt; and &gt; in your comment are actually converted to < and > by GitHub markdown:

    I’m currently using macOS with the zsh shell, and I’ve noticed that when copying commands from web sources or documentation, they often include HTML-encoded characters like &lt;SUBSCRIPTION_ID&gt; instead of the correct <SUBSCRIPTION_ID>. This causes parsing errors in both zsh and Terraform, especially when setting environment variables or executing CLI commands.
    For example:
    ShellSUB="&lt;SUBSCRIPTION_ID&gt;"  # ❌ FailsSUB="<SUBSC
    SUB="&lt;SUBSCRIPTION_ID&gt;"  # ❌ Fails
    SUB="<SUBSCRIPTION_ID>"        # ✅ Works correctly
    
    Image

    Commands copied from web sources seem to include HTML-encoded characters like &lt; instead of <

    Could you share some example web sources? This doesn't seem to happen on Windows or Linux.

    Also, the < and > are merely placeholders meaning the string <SUBSCRIPTION_ID> should be replaced by a real subscription ID or name, so a real command should look like

    az account set --subscription "2b476f58-53d6-40e7-b051-f4ec1fcad3d5"
    az account set --subscription "Azure subscription 1"
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ARMaz resource/group/lock/tag/deployment/policy/managementapp/account management-groupAccountaz login/accountAuto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamact-identity-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions