These examples show how to work with changing accounts, and subscriptions in Azure using PowerShell.
- Must Run PowerShell
- Requires PowerShell Azure Module which can be installed from here
This will bring back user ID, Type, Subscriptions, Tenants
Get-AzureAccount
This is especially helpful to get rid of old accounts that have expired!
Get-AzureAccount | ForEach-Object { Remove-AzureAccount $_.ID -Force }
## List Azure Subscriptions
get-AzureSubscription | Format-table SubscriptionName, isDefault, isCurrent, DefaultAccount, subscriptionid
Add-AzureAccount
## List Azure Subscriptions in a table
get-AzureSubscription | Format-table SubscriptionName, isDefault, isCurrent, DefaultAccount, subscriptionid
Set-AzureSubscription -SubscriptionId "090fa8f2-cc0e-4d36-8cc7-22223321993796"
Select-AzureSubscription -Default -SubscriptionId "090fa8f2-cc0e-4d36-8cc7-1111f21993796"
Select-AzureSubscription -SubscriptionId "090fa8f2-cc0e-4d36-8cc7-122221993796" -Current