1

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
Blue Clouds
  • 7,295
  • 4
  • 71
  • 112

1 Answers1

1

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

Andriy Bilous
  • 2,337
  • 1
  • 5
  • 16