本文介绍了Azure CLI对帐户/订阅感到困惑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 10 Pro上运行PowerShell 5.1并刚刚安装了Azure CLI 2.0.60。 我有一封与5个Azure订阅相关联的公司电子邮件。 我有另一个(不同的)电子邮件绑定到1个Azure中国订阅。


当我第一次做"Connect-AzAccount"时,它要求我的公司凭据,接受它们,然后将我连接到我的Azure中国订阅。 我尝试过的所有az命令都有效(例如我可以列出位置,资源等)。 但是,这个
不是我想要的帐户(也没有提供凭据)。


我做了"az logout"然后"az登录"。 在再次询问我的公司凭证并登录后,它显示了我的一个订阅。 当我执行"az帐户列表"时,我被告知我需要执行"az登录"。 
我这样做了,并再次提供了我的公司资质。 接受后,PowerShell中会显示以下内容:


     未找到"无"的订阅。如果是这种情况,请使用' - allow-no-subscriptions'进行租户级别访问


我试过"az帐户集 - 子订阅<有效订阅名称>"并收到:


  &NBSP; &NBSP;云"AzureChinaCloud"中不存在"<有效订阅名称>"的订阅。


我之后也试过这个重新启动我的系统,然后执行"Connect-AzAccount"。 结果是一样的。


为什么我要继续使用Azure China(使用我的非中国证书)和我无法连接到我的其他Azure订阅?


是否有一些需要清除的缓存?


解决方案


I am running PowerShell 5.1 and just-installed Azure CLI 2.0.60 on Windows 10 Pro.  I have a corporate email tied to 5 Azure subscriptions.  I have another (different) email tied to 1 Azure China subscription.

When I first did 'Connect-AzAccount' it asked for my corporate credentials, accepted them, then connected me to my Azure China subscription.  All of the az commands that I tried worked (e.g. I could list locations, resources, etc.).  However, this isn't the account I wanted (nor provided the credentials for).

I did "az logout" then "az login".  After asking for my corporate credentials again and signing me in, it displayed one of my subscriptions.  When I did "az account list", I was told that I needed to do "az login".  I did that and again provided my corporate credentials.  Once accepted, the following was displayed in PowerShell:

      No subscriptions were found for 'None'. If this is expected, use '--allow-no-subscriptions' to have tenant level accesses

I tried "az account set --subscription <valid subscription name>" and received:

      The subscription of '<valid subscription name>' doesn't exist in cloud 'AzureChinaCloud'.

I also tried this after rebooting my system, then doing a "Connect-AzAccount".  The results were the same.

Why do I keep getting Azure China (using my non-China credentials) and am unable to connect to my other Azure subscriptions?

Is there some cache that needs to be cleared out?

解决方案


这篇关于Azure CLI对帐户/订阅感到困惑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 13:53