无法删除Azure订阅 [英] cannot remove azure subscription

查看:546
本文介绍了无法删除Azure订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用此命令Remove-AzureSubscription"XXX"删除订阅.当我再次使用Get-AzureSubscrition命令时,它将显示我已删除的订阅.如何解决此问题并使用Power Shell完全删除订阅.

I have used this command Remove-AzureSubscription "XXX" to remove the subscription. When I use the Get-AzureSubscrition command again It display the subscription which I have deleted. How to resolve this issue and remove the subscription completely using power shell.

推荐答案

Get-AzureSubscription当前始终转到Azure API,以返回与该会话的帐户凭据相关的订阅列表. Remove-AzureSubscription确实可以从本地已知"订阅列表中删除该订阅,但是如果再次执行Get-AzureSubscription,则订阅列表将被刷新.

Get-AzureSubscription currently always goes out to the Azure API to return the list of subscriptions related to the account credentials for the session. The Remove-AzureSubscription does work to remove the subscription from the list of "known" subscriptions locally, but if you perform a Get-AzureSubscription again the list of subscriptions gets refreshed.

如果执行Get-AzureSubscription,然后执行Remove-AzureSubscription,然后尝试将当前订阅设置为使用Select-AzureSubscription刚删除的订阅,则可以看到此内容.该cmdlet将失败,说明"Select-AzureSubscription:订阅名称someSub不存在."

You can see this if you perform a Get-AzureSubscription, followed by a Remove-AzureSubscription and then try to set the current subscription to the one you just removed using Select-AzureSubscription. That cmdlet will fail stating, "Select-AzureSubscription : The subscription name someSub doesn't exist."

Remove-Subscription帮助明确指出,"Remove-AzureSubscription cmdlet将从订阅数据文件中删除Azure订阅,因此Windows PowerShell无法找到它.此cmdlet不会从Microsoft Azure删除订阅,或者以任何方式更改实际的订阅." Get-AzureSubscription cmdlet实际上将数据文件更新回包括所有订阅.

The Remove-Subscription help is explicit when it states, "The Remove-AzureSubscription cmdlet deletes an Azure subscription from your subscription data file so Windows PowerShell can't find it. This cmdlet does not delete the subscription from Microsoft Azure, or change the actual subscription in any way." The Get-AzureSubscription cmdlet actually updates the datafile back to include all subscriptions.

如果您正在寻找一种获取订阅列表然后进行迭代而又排除其中一些订阅的方法,则需要以不同于每次需要时调用Get-AzureSubscription的方式来设置该列表.另一个选择是,您可以报告在GitHub上发布Azure cmdlet的问题,以请求以下参数: Get-AzureSubscription,它将只在本地返回数据文件中的内容,而无需刷新它.

If you are looking for a way to get a list of subscriptions to then iterate through while excluding some of them you will need to set up that list differently than just calling Get-AzureSubscription each time you need it. Another option is you can report an Issue on GitHub for the Azure cmdlets to request a parameter for Get-AzureSubscription which would only return the ones in the data file locally without refreshing it.

更新:我想到您可能正在问如何使用PowerShell完全删除订阅.当前没有一种方法可以做到这一点.如果您需要取消订阅,请通过帐户站点进行.您登录并选择订阅"选项卡.然后选择订阅,在右侧有一个取消订阅.这是取消订阅的方式,必须由服务管理员完成.请注意,这可能不会立即从PowerShell Get-AzureSubscription调用中删除订阅.取消的订阅可能会停留一段时间.

Update: it occurred to me that you may be asking how to delete a subscription completely using PowerShell. There is not currently a way to do that. If you need to cancel a subscription you do that via the account site. You log in and select the Subscriptions tab. Then select the subscription and on the right hand side there is a cancel subscription. This is how you cancel a subscription and it must be done by the Service Administrator. Note that this may not remove the subscription from your PowerShell Get-AzureSubscription calls immediately. The cancelled subscription may hang around a while.

这篇关于无法删除Azure订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆