Azure-cli: az: error: unrecognized arguments: -e AzureChinaCloud

Created on 10 Mar 2017  路  3Comments  路  Source: Azure/azure-cli

CLI Version: 2.0.0
OS Type: Win7 x64
Installation via: pip (python 3.5.2)

Environment: Azure China Cloud

Description:
az login -u {username} -e AzureChinaCloud command doesn't allow to login but error throws out

az: error: unrecognized arguments: -e AzureChinaCloud

Steps to reproduce:
1) After installed python 3.5 and then installed azure-cli 2.0 via pip install --user azure-cli
2) Check az --version output: azure-cli (2.0.0)
2) Then run az login -u {username} -e AzureChinaCloud

Error stack trace:

..\AppData\Roaming\Python\Python35\Scripts>az login -u {username} -e AzureChinaCloud --verbose
az: error: unrecognized arguments: -e AzureChinaCloud
usage: az [-h] [--output {json,tsv,table,jsonc}] [--verbose] [--debug]
[--query JMESPATH] {network,iot,storage,ad,acs,batch,appservice,snapshot,vm,disk,tag,role,keyvault,sql,vmss,documentdb,group,policy,redis,component,login,resou
rce,feature,image,lock,logout,cloud,account,container,provider,configure,feedback}
...

Original issue file by @ginocui over here https://github.com/Azure/azure-xplat-cli/issues/3531

Cloud

Most helpful comment

@ginocui

$ az cloud set -n AzureChinaCloud
$ az login -u {username}

All 3 comments

@ginocui

$ az cloud set -n AzureChinaCloud
$ az login -u {username}

@derekbekoe Thanks for your advice

It works to me for switching cloud to china area with the command. However, the second normal login command doesn't work well, instead, throw an error

Get Token request returned http error: 400 and server response: {"error":"invalid_grant","error_description":"AADSTS50034: To sign into this applicati
on the account must be added to the _[cloud account]_ directory.\r\nTrace ID: b65e56d1-4675-44d0-a29e-3cc6625f7d37\r\nCorrelation ID: 38066
dfd-6e36-4224-9d87-17ec14fd6835\r\nTimestamp: 2017-03-13 06:17:01Z","error_codes":[50034],"timestamp":"2017-03-13 06:17:01Z","trace_id":"b65e56d1-4675
-44d0-a29e-3cc6625f7d37","correlation_id":"38066dfd-6e36-4224-9d87-17ec14fd6835"}

No idea what's the root cause. Will contact the local azure support for clarification. Any updates will post here.

After consult with local azure support team, Azure CLI 2.0 (generally available release) doesn't work well to Azure China due to the incompatibility issues. The issue will be resolved in future RC and stable release. I was advised that Azure CLI 0.10.8 (.9 and .10 both are still incompatible) current stable version azure-xplat-cli

@amarzavery please help to close this issue.

Was this page helpful?
0 / 5 - 0 ratings