Martin Brandl
Martin Brandl

Reputation: 58931

Get-AzureService does not list all cloud services (multiple subscriptions)

I got two azure subscriptions (sub1 and sub2). Requesting the cloud services in powershell with Get-AzureService does only list the services from sub1 and not sub2.

I also tryed to set the azure subscription using Set-AzureSubscription for sub2, without success.

How can I get the services in powershell from sub2?

Upvotes: 2

Views: 5813

Answers (3)

Óscar Andreu
Óscar Andreu

Reputation: 1700

The others methods doesn't works for me, so here's my two cents:

Get the list of subscriptions:

Get-AzureRmSubscription

Select the subscription using the subscription Id provided by the other call

Select-AzureSubscription -SubscriptionId "xxxx-xxxx-xxxx-xxxx" -Current

Upvotes: 1

GoonDog
GoonDog

Reputation: 41

This has actually changed in recent PowerShell versions. -DefaultSubscription no longer exists as a parameter.

You should now use Select-AzureSubscription http://msdn.microsoft.com/en-us/library/dn495203.aspx

Select-AzureSubscription -Current "sub2"

Get-AzureSubscription | fl SubscriptionName, SubscriptionId, IsDefault, IsCurrent

Upvotes: 2

Martin Brandl
Martin Brandl

Reputation: 58931

ohhh, I got it:

Set-AzureSubscription -DefaultSubscription "sub2"

Upvotes: 1

Related Questions