Over a million developers have joined DZone.

Azure CLI Day 3 – Account Set

DZone 's Guide to

Azure CLI Day 3 – Account Set

· Cloud Zone ·
Free Resource
In my previous post, 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 an 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.

Bash azure

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 to do is open an instance of your command line (Terminal, Bash, Command Prompt, etc.) and type the following:

Azure Account List

00 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

01 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:


02 account set

To verify the current subscription has changed, execute the following command:

Azure Account List

03 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 too 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 we need to cover this is that 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.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}