如何在Windows Azure门户中设置默认订阅?
当我登录到Windows Azure门户时,它会将我的默认订阅设置为我不再有权访问的朋友帐户。我想将帐户设置为我的默认帐户如何在Windows Azure门户中设置默认订阅?,azure,msdn,azure-configuration,Azure,Msdn,Azure Configuration,当我登录到Windows Azure门户时,它会将我的默认订阅设置为我不再有权访问的朋友帐户。我想将帐户设置为我的默认帐户 C:\Users\gbonk>azure account show Pay-As-You-Go info: Executing command account show data: Name : Pay-As-You-Go data: ID : *****
C:\Users\gbonk>azure account show Pay-As-You-Go
info: Executing command account show
data: Name : Pay-As-You-Go
data: ID : ********-****-****-****-************
data: State : Enabled
data: Tenant ID : ********-****-****-****-************
data: Is Default : false
data: Environment : AzureCloud
data: Has Certificate : No
data: Has Access Token : Yes
data: User name : gbonk
data:
info: account show command OK
如果我点击订阅图标,它有一个按目录筛选的列表,它会列出我的所有订阅。我不再有权访问的目录被列为默认目录。我该如何改变这一点
当我登录时,URL会将我指向以下内容:
其中[SomeAccount]是我不再需要的订阅的名称。知道为什么我登录时会显示为默认值吗?有没有办法摆脱这种情况,或者在登录时将我自己的订阅设置为默认订阅
下拉列表显示了所有将您列为管理员的目录,我相信它们只是按字母顺序排列的 我认为你不能永久过滤下拉列表,因此你有两个选择- 确保您不再是任何不打算使用的订阅的管理员 为直接指向您希望使用的目录的链接添加书签。这将是windowsazure.com/@
在安装了Azure命令的PowerShell中,这对我来说很有效:
1) Add-AzureAccount;
2) Get-AzureSubscription;
3) Select-AzureSubscription -SubscriptionName <YourSubscriptionName>
在撰写本文时,azure团队尚未解决此问题 但这里有两种解决方法,这两种方法对我都适用: 将目录名作为URL的一部分,例如: 转到旧门户。 然后在屏幕顶部选择“订阅”,并从“按目录筛选”中确保选择的是您自己的订阅—您是该订阅的管理员,而不是联合管理员—然后选择“管理订阅/目录”。选择您的主订阅并按任务栏屏幕底部的“编辑目录”链接,然后将“目录”字段更改为您希望默认设置的目录
我在windows命令提示符下使用CLI
C:\Users\gbonk>azure account list
info: Executing command account list
data: Name Id Current State
data: ------------- ------------------------------------ ------- --------
data: Free Trial ********-****-****-****-************ false Disabled
data: Pay-As-You-Go ********-****-****-****-************ true Enabled
info: account list command OK
查看“帐户显示”,您可以看到支付帐户当前不是默认帐户
C:\Users\gbonk>azure account show Pay-As-You-Go
info: Executing command account show
data: Name : Pay-As-You-Go
data: ID : ********-****-****-****-************
data: State : Enabled
data: Tenant ID : ********-****-****-****-************
data: Is Default : false
data: Environment : AzureCloud
data: Has Certificate : No
data: Has Access Token : Yes
data: User name : gbonk
data:
info: account show command OK
执行以下命令后,付费订阅成为我的默认订阅
C:\Users\gbonk>azure account set Pay-As-You-Go
info: Executing command account set
info: Setting subscription to "Pay-As-You-Go" with id "********-****-****-****-************".
info: Changes saved
info: account set command OK
C:\Users\gbonk>azure account show Pay-As-You-Go
info: Executing command account show
data: Name : Pay-As-You-Go
data: ID : ********-****-****-****-************
data: State : Enabled
data: Tenant ID : ********-****-****-****-************
data: Is Default : true
data: Environment : AzureCloud
data: Has Certificate : No
data: Has Access Token : Yes
data: User name : gbonk
data:
info: account show command OK
付费订阅现在是我的默认设置
C:\Users\gbonk>azure account set Pay-As-You-Go
info: Executing command account set
info: Setting subscription to "Pay-As-You-Go" with id "********-****-****-****-************".
info: Changes saved
info: account set command OK
C:\Users\gbonk>azure account show Pay-As-You-Go
info: Executing command account show
data: Name : Pay-As-You-Go
data: ID : ********-****-****-****-************
data: State : Enabled
data: Tenant ID : ********-****-****-****-************
data: Is Default : true
data: Environment : AzureCloud
data: Has Certificate : No
data: Has Access Token : Yes
data: User name : gbonk
data:
info: account show command OK
你也可以在~/.azure/azureProfile.json中查看这一点,最新的2020年一月:我们可以做到。 在门户->订阅->左上角
"Showing subscriptions in <company>. Don't see a subscription?
Switch directories "
此“切换目录”将帮助您使用Azure CLI切换到默认目录。您可以轻松设置:
az account set -s <id>
并复制相应的id属性。对于1,我认为我无法从该订阅中删除自己。除了在下拉列表中看到它之外,我似乎没有访问它的权限。对于2,这与在下拉列表中更改订阅相同。但似乎应该有办法更改它,以便在默认情况下显示正确的帐户。如果订阅位于下拉列表中,并且您可以选择它,那么您应该仍然可以访问您。您可以从订阅中删除自己的联合管理员身份…正如McCollier所说:-。我知道这不是您想要得到的答案,但我认为这是目前唯一可能的。当然,有一种方法可以将其中一个设置为默认值,而将其他设置为非默认值-例如,在Microsoft.WindowsAzure.Commands.Profile.Models.PSAzureSubscription对象上,PowerShell返回的是IsDefault属性,这会选择门户的行为,但就我的一生而言,我不知道如何更新该值并将其返回Azure以便应用。我让旧帐户的所有者将我作为联合管理员删除,它将我删除,因此它不再是默认值。知道如何手动切换默认值还是不错的。截至2015年12月,除了尝试@yossi dahan建议的选项外,我还没有找到一种简单的方法将订阅设置为默认值。虽然我已被删除为联合管理员,但它仍然显示在新门户中我的订阅列表下拉列表中,尽管不是在旧门户中,也不是通过PS。但正确地单击该订阅表示我没有访问权限。希望有一种方便的方法来区分多个订阅。这是一个开放的问题,现在有一段时间,只有大量的投票可能会导致发生变化-这是一个问题,我试图使用Microsoft Learning,它希望创建临时培训沙箱,我的帐户有多个订阅,每个订阅都有不同的权限:-