If like me, you are spinning up demo or test Azure subscriptions. You will often want to quickly clear your subscription and delete everything within it.

This PowerShell script will allow you to select which Azure subscription you want to clear and will then delete EVERYTHING inside that subscription allowing you to start from scratch.

USE THIS WITH CAUTION!

# Login
Login-AzAccount 

# Get a list of all Azure subscriptions that the user can access and allow them to select one to be cleared
$SubscriptionId = (Get-AzSubscription | select Name, State, SubscriptionId, TenantId | Out-GridView -Title "Select Azure Subscription To Clear" -PassThru).SubscriptionId
Get-AzSubscription -SubscriptionId $SubscriptionId | Select-AzSubscription

# Warning confirmation
Write-Warning "Are you sure you want to DELETE EVERYTHING in Azure Subscription with ID $SubscriptionId" -WarningAction Inquire

# Get all resources and delete them
Get-AzResource | ForEach { Remove-AzResource -ResourceId $_.ResourceId -Force -Confirm:$False }