问题
I am looking for a way to delete Azure subscription programmatically. I'm mainly interested in Azure CLI but i can not find the way to do that in proper way.
By the way there is PowerShell Command which provide exactly needed action. Remove-AzureSubscription
回答1:
there is no way to delete a subscription. the linked cmdlet doesn't do what you think it does:
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.
only Azure Support might be able to help you, although in my case they said its impossible to delete subscriptions.
回答2:
New feature in REST API already as preview:
The operation to cancel a subscription
https://docs.microsoft.com/en-us/rest/api/resources/subscriptions%20(preview)/cancel
来源:https://stackoverflow.com/questions/58081649/azure-cli-delete-subscription