4

Using the Powershell Azure module, is there a way to get the active subscription ID?

I can set the subscription using Set-AzContext, but Get-AzContext returns the subscription name without a specific ID column

Get-AzSubscription returns a list of subscriptions, but not the active subscription.

boxdog
  • 7,894
  • 2
  • 18
  • 27
Ron Dunn
  • 2,971
  • 20
  • 27

1 Answers1

11

you could do that with the following command:

(Get-AzContext).Subscription.id
4c74356b41
  • 69,186
  • 6
  • 100
  • 141