0

I'm very new to PowerShell, and I was wondering if it is possible to disable an azure subscription through Powershell, I can't find any documentation online. any working examples or referral to documentation would be a helpful start.

DarkCloud
  • 3
  • 3

2 Answers2

1

Look at here: https://docs.microsoft.com/en-us/powershell/module/az.subscription/update-azsubscription?view=azps-4.8.0

This cmdlet is part of this Module: https://www.powershellgallery.com/packages/Az.Subscription/0.7.1-preview

This command will cancel a Subscription:

Update-AzSubscription -SubscriptionId "86869d42-1782-4337-98b0-c905fb937d46" -Action "Cancel"

The allowed Values for the Parameter -action are missing. Bad documented by Microsoft! :-(

Gill-Bates
  • 489
  • 5
  • 17
1

Short answer is, No.

Azure account cannot be disable, except by Microsoft for things like overage and nonpayment.

Also, most billing changes cannot be done using PowerShell.

If this is something that you see a use case for you can always leave a feedback

https://feedback.azure.com/forums/170030-signup-and-billing

Hannel
  • 651
  • 4
  • 9
  • That's not true! You can disable Subscriptions inside the Portal. The question was how to automate this with Powershell – Gill-Bates Oct 20 '20 at 09:24
  • My friend, you are commenting on a post almost a year old. Check you module history back then it was not possible no `Update-AzSubscription` cmdlet – Hannel Oct 21 '20 at 17:16