When I run this command on azure cloudshell, it shows the subscription is switched but it actually is not. Because the next command I execute is done in another subscription(initial one).
Select-AzSubscription -SubscriptionId <id> -verbose
When I run this command on azure cloudshell, it shows the subscription is switched but it actually is not. Because the next command I execute is done in another subscription(initial one).
Select-AzSubscription -SubscriptionId <id> -verbose
First of all Select-AzSubscription
is alias of Set-AzContext
cmdlet
https://github.com/Azure/azure-powershell/issues/10848
Microsoft recommends to use
Get-AzSubscription -SubscriptionName 'MySubscriptionName' | Set-AzContext -Name 'MyContextName'
https://learn.microsoft.com/ru-ru/powershell/azure/manage-subscriptions-azureps?view=azps-5.3.0