Introduction
Microsoft //BUILD is just 3 days away and while I'm just (super) sad that I will not attend, I wanted to bring a "special" gift.
After some discussion on Twitter with @Tara_msft, she asked me if I tried Azure Cloud Shell.
She past a link to the (incredibly) excellent @docmsft site. And the Pandora box was definitively open...
What if, I could tweak the "$HOME" hack and make it available "everywhere"!
Or, due to the limitation of the Azure free account (in terms of storage capacity) and the "Network drives" permissions/behavior, at least I could put the important dot files in the Cloud Drive while keeping the development files on the "Interop zone" (read: /mnt/c/...) as described in Brian's blog post.
The crazy idea
after looking at the Cloud Shell, and reading about Spot Instant Cloud, this (crazy) idea came to life:What if, I could tweak the "$HOME" hack and make it available "everywhere"!
Or, due to the limitation of the Azure free account (in terms of storage capacity) and the "Network drives" permissions/behavior, at least I could put the important dot files in the Cloud Drive while keeping the development files on the "Interop zone" (read: /mnt/c/...) as described in Brian's blog post.
To be prepared, you must
Before we can apply what follows, some preparation is needed.
The major one being: you must have an Azure account. Gladly, Microsoft offers a free account!
Once you completed the creation of your new account, you can login to https://shell.azure.com/ if you want a full page console, or login to https://portal.azure.com and click on the Cloud Shell icon.
The first time, it will warn you that you need to create an Azure Files Storage.
Follow this guide to get you fully started.
On your computer, you need to have WSL installed with your preferred distribution (search for Linux in Microsoft Store).
Well, it's simple, for mounting the Cloud Drive in Linux, we need Fuse and for the time being, it's still not handled in WSL.
However, we can mount Windows drives into WSL, and following the docs, we can mount (read: network drive) the Cloud Drive in Windows.
Here is a quick summary based on the docs:
Follow this guide to get you fully started.
On your computer, you need to have WSL installed with your preferred distribution (search for Linux in Microsoft Store).
Mounting the Clouddrive: Windows side
Ok, first of all: we want to mount the Azure Shell Cloud drive in WSL, so what is this Windows side all about?Well, it's simple, for mounting the Cloud Drive in Linux, we need Fuse and for the time being, it's still not handled in WSL.
However, we can mount Windows drives into WSL, and following the docs, we can mount (read: network drive) the Cloud Drive in Windows.
Here is a quick summary based on the docs:
- Connect to https://portal.azure.com
- Click on "Storage Accounts" on the left menu
- You should see at least one line with the Cloud Shell drive
- Click on the name to get to the account summary page
- Click on "Files" to get the file share details
- Click on the name of the file share
- Click on "Connect" to see the connection helper on the right
- Open an Explorer window and click on "This PC"
- Click on "Map Network drive"
- Choose the drive letter and enter the network path that you see in the "net use" connection helper and click on "Connect using different credentials"
- Click on finish
- Enter the username with the "Azure" domain
- Enter the access key as the password
- Click OK to complete the mapping
You should now be able to see you drive mounted with, normally, only one directory ".cloudconsole"
Mounting the Clouddrive: WSL side
As all the heavy lifting was done on Windows side, on WSL we will simply map the drive:- Launch your favorite distro (here I will use Ubuntu)
- Mount the drive with the letter you chose (here I will use Z:) to either the "/mnt/" path or, in my case, to a directory in my $HOME
And that's all! Here is the gif I made to share on Twitter the full setup with a small demo at the end:
Once again, I really hope someone will find this useful and do not hesitate to ping me in Twitter to share your experience or even better, a link to your own take at this "feature".
As for the WSL, Azure and Docs teams: please continue to bring such cool features, I will keep having these crazy ideas on how to connect them :)
>>> Nunix Out <<<
Comments
Post a Comment