PowerShell 1.0 and ARM – Tenants and Subscriptions

In my previous post you got intro to getting started with Power Shell 1.0 and Azure Resource Manager (ARM)

Also take a look at this post by @s_lapointe

In this post I hope to inspire you to continue with it.

Authenticate with Multiple Tenants!

The Solution is: Login-AzureRmAccount -SubscriptionId “subscription you want to manage”

Before PowerShell 1.0 i mostly used Add-AzureAccount to authenticate and get access to Tenants and Subscriptions where my account was Admin or Co-Admin.

Now I use Login-AzureRmAccount or Add-AzureRmAccount.

The issue with this is that I get authorized to where my account is defaulted, running Get-AzureRmSubscription tells me I only can manage 2 Subscriptions in 1 Tenant.

I took me embarrassingly long to figure out… but after a while I resorted to the help files. Help Login-AzureRmAccount -full

It tells me that by default a user is authenticated against all subscriptions by default, but the Get-AzureRmSubscription does not show the subscriptions I wanted to manage. (I even found misspelling, se the arrows in the picture)

At the end of the help file you have the information that you can Select Tenant and Subscription

But Add-AzureRmAccount –TenantId gave this error


Intellisens pointed me to Add-AzureRmAccount –Tenant

Summary

This is how I now start the day with ARM

  1. Start PowerShell ISE
  2. Add-AzureAccount¨
  3. Get-AzureSubscription
  4. Copy the SubscriptionId
  5. Login-AzureRmAccount –SubscriptionId “paste in the copied SubscriptionId”

Now I will continue with some templating using PowerShell with Azure Resource Manager

3 thoughts on “PowerShell 1.0 and ARM – Tenants and Subscriptions

  1. Thanks for that! Really helped me get up to speed with the 1.0 Preview. Am I right in thinking that Login-AzureRmAccount is an alias for Add-AzureRmAccount?

    Cheers – Graham

    • Hi
      Great that the post helped.

      Yes, to what i have been able to figure out the command do the same.. but.

      Run the command
      gcm -module * -ParameterName subscriptionid

      You will get the equivalent commands for the purpose.
      I think this will still be polished in coming releases but for now Login-AzureRmAccount does the same thing as Add-AzureRmAccount

Leave a Comment