Azure Tips and Tricks Part 13 - Demystifying storage in Cloud Shell

2 minute read


Most folks aren’t aware of how powerful the Azure platform really is. As I’ve been presenting topics on Azure, I’ve had many people say, “How did you do that?” So I’ll be documenting my tips and tricks for Azure in these posts.

The Complete List

Click here to view the complete list of Azure Tips and Tricks

Video Available

What’s under the hood of Azure Cloud Shell?

The Azure Cloud Shell is something that I’ve took for granted since it launched at Build 2017. I always knew that I could use it to run CLI 2.0 commands and didn’t really stop to think what is “Under the hood”… until now.

When you first open the Cloud Shell, you will find that it requires you to create a Storage account. The reason for that Storage Account is to persist the scripts, keys, etc that you’ll use over and over as you interact with your resources.

You can find it once you go to your Resource Group and look for cloud-shell* as shown below.

If you drill down into the Storage account, you’ll land on two directories - .cloudconsole and .pscloudshell. More on that later.

Open the Azure Cloud Shell inside of the portal by clicking on the icon at the top (looks like >_)

Keep in mind that the Cloud Shell is based off an open-source implementation of Xterm.js that emulates the terminal in your browser. It is talking over a web socket to a full Linux BASH shell. Begin by typing:

michael@Azure:~$ ls -l
total 0
lrwxrwxrwx 1 root root 23 Sep 10 16:27 clouddrive -> /usr/michael/clouddrive

Great, we see a clouddrive that is mapped to /usr/michael/clouddrive

Change into that directory and list it out.

michael@Azure:~$ cd clouddrive
michael@Azure:~/clouddrive$ ls -l
total 0

Nothing there? Or is there?

Remember the .cloudconsole and .pscloudshell directories from above?

michael@Azure:~/clouddrive$ cd .cloudconsole
michael@Azure:~/clouddrive/.cloudconsole$ ls

Nice! We just found a acc_michael.img file. This is a 5 gig image that persist your home directory. You could have also navigated through the portal to see what was inside this directory but now you under the CLI better! For those that want an extra challenge, go to the Azure Portal and download the Image file and explore it. Feel free to post comments on what you found below.

So what about the other file called .pscloudshell?

We’ll this is for the PowerShell feature coming to the Cloud Shell! You’ll have to explore this one for yourself as it is preview at the time of writing. But you can request access now through this form!

Want more Azure Tips and Tricks?

If you’d like to learn more Azure Tips and Tricks, then follow me on twitter or stay tuned to this blog! I’d also love to hear your tips and tricks for working in Azure, just leave a comment below.

Leave a Comment