Easily Switch Between Azure Subscriptions and Tenants
$SubscriptionId = "Your-Subscription-Guid" if($(Get-AzureRmContext).Subscription.SubscriptionId -ne $SubscriptionId){ Set-AzureRmContext -SubscriptionId $SubscriptionId -ErrorAction SilentlyContinue if($(Get-AzureRmContext).Subscription.SubscriptionId -ne $SubscriptionId){ Clear-AzureRMContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue Clear-AzureRmDefault -Force -ErrorAction SilentlyContinue $connect = Add-AzureRmAccount -SubscriptionId $SubscriptionId } }