Azure CLI Day 4 – account clear

September 10, 2013

bash-azure

In my previous post http://thinkfirstcodelater.com/blog/?p=2995 I showed you how to set the context of a Azure command line session to use a specific subscription. Before proceeding with showing you how to manage your Windows Azure services using the command line, there is one more thing I need to show you. In my second (http://thinkfirstcodelater.com/blog/?p=2966) and third (http://thinkfirstcodelater.com/blog/?p=2978) post of this series I showed you how to download and import a .PUBLISHSETTINGS file into the Windows Azure command line. At the end of third post I mentioned that you should delete the local copy of the .PUBLISHSETTINGS file to prevent others from gaining control of your Windows Azure services. However, deleting the .PUBLISHSETTINGS file will not prevent someone from gaining access to you your Azure services if you’ve already imported the file into the command line and the malicious individual happens to get access to your console. In this post I’ll show you how remove this sensitive information from the Azure command line.


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

00-azure-account-list

This will simply list the account you imported with your .PUBLISHSETTINGS file. We’ll use this as a comparison point to ensure all of your account information has been deleted a little later on.

To clear the account information you’ll use the clear command. Before executing the command type the following into the console

azure account clear -h

01-azure-account-clear-h

Clear is the command used to delete account information. This simply shows you the usage of the clear command. As with the other commands we’ve looked at so far, there isn’t much to see.

It’s time to execute the command by typing the following:

azure account clear

02-azure-account-clear

As you can see in the image, a simple message is returned letting you know the information was cleared successfully. To verify this you can execute the following command:

azure account list

03-azure-account-list

If the clear command was in fact successful, you should see an error message telling you to import account information (a.k.a. the .PUBLISHSETTINGS file).

This wraps up the basics of how to get up and running with the Windows Azure command line tools. In the next post we’ll start getting down to work by creating a web site directly from the terminal.

Did you know you can try Windows Azure for free for 30 days? Just go to http://aka.ms/thecloud and sign up.