In my previous post http://thinkfirstcodelater.com/blog/?p=2978 I showed you how to import your Windows Azure account information, also known as your publishing settings, using the Windows Azure command line tools. In this post I’ll show you how to set the context of a Azure command line session to use a specific subscription. Note, if you only have a single Windows Azure subscription you don’t need to follow the steps in this post.
Once again, just a reminder that I’m using the command line tools on a MacBook Air with OSX (Mountain Lion) installed, and I’m using Google Chrome as my default browser. However, the experience should be identical on Windows and Linux as well.
The first thing you’ll need want to do is open an instance of your command line (Terminal, Bash, Command Prompt, etc.) and type the following:
azure account list
The account with a Current value of true is the account whose services you can access during the current console session. In my case the current account is set to Azdem194M85946L. I want to change this to the account called Microsoft DPE. To do so, I’ll start by copying the Id of the account. If you have multiple accounts, determine which account you want to set the current account to and copy its Id.
Next, you’ll want to execute the account set command. Start by typing the following:
azure account set -h
This shows you how to use the command. In this case you’ll need to provide the Id of the subscription you want to set to the current subscription. Enter the following command into the terminal:
azure account set [ID OF YOUR SUBSCRIPTION]
To verify the current subscription has changed execute the following command:
azure account list
Notice my current subscription has changed to Microsoft DPE. You should see a similar result in your console.
Now I’ll admit, these first few posts haven’t been to exciting, but I promise that is about to change – SOON! However, there is one more thing I need to cover, how to clear your account information from the command line. The reason for this is that, just like the .PUBLISHSETTINGS file, if someone gets access to your console after you imported the .PUBLISHSETTINGS file they can manage your Windows Azure services. I’ll show you how to remove account information from your console in my next post.
Did you know you can try Windows Azure for free for 30 days? Just go to http://aka.ms/thecloud and sign up.