25
votes

In Azure Classic / Service Management, Get-AzureSubscription would give a list of subscriptions in the Tenant with an indicator of which was current.

There was also a Get-AzureSubscription -Current flag that would give you just the current subscription.

Is there a way to find the current subscription in AzureRM.Profile?

3

3 Answers

58
votes

Get-AzureRmContext gives you info about the selected subscription, default storage account, etc.

(Get-AzureRmContext).Subscription gives you the current subscription.

9
votes

Now you can use the new Az commands

Get-AzContext

1
votes

You can also use Get-AzureRmSubscription

$sub = Get-AzureRmSubscription
$sub.SubscriptionId

This will give you the SubscriptionId