Introduction to “Azure Cloud Shell – Storage”
This is chapter two of my Azure Cloud Shell Web Series and today we are discussing – How Storage works in Azure Cloud Shell and what is a cloud drive. You’ll also learn how to upload files to cloud shell and dismount mount the default cloud drive from a cloud shell and mount a new custom storage.
If you like this video, please subscribe to my youtube channel here which is the motivation for me to create more such videos 🙂 thank you!
How Storage Works
First thing first, when you click on the Azure Cloud Shell icon in the Azure portal it your shell launches and under the hoods it hooks up with one of the hundreds of Geo-Dispersed containers in Azure, nearest to your location.
These containers are just sitting there to serve any cloud shell session and utilize the storage account and the file share which is created by default when you launch the Cloud Shell for the first time. If you go to your home drive and then to the cloud drive folder using the shell you’ll notice two folders present there –
- .cloudconsole is for bash files, and
- .pscloudshell is to persist you PowerShell files and modules
you can also access the ‘.pscloudshell’ folder in the cloud drive and notice that it has Windows PowerShell and Module folders exactly like you have on your local machine. The whole purpose of Cloud drive is to persist is your files, scripts and installed modules no matter if you start a restart a session or closes a running one.
The file share mounted to the cloud shell can also accessed from the file share in you storage account and you also have an button to upload files from your local computer to the cloud drive, like in the following screenshot.
To get more details of your current cloud drive and the mounted file share run the following commands
Mount a New Storage to Azure Cloud Shell
There would some scenarios where you may want to dismount your default cloud drive and mount a new file share to your Azure cloud shell, in order to achieve that first create a new storage account if you already don’t have one
and now run the Dismount-CloudDrive cmdlet which will initiate the dismount of File share and kill your current session.
Now launch the cloud shell again and click on PowerShell (Windows) link
But now go to show advanced settings
and now choose the correct drop down items to target your new file share, once you are done, click ‘Attach Storage‘ to mount the new storage to the azure cloud shell.