Microsoft Azure Storage Explorer is a widely used tool by all Azure cloud administrators. However, with the increasing number of Linux VMs in the Azure Cloud, having a working version of Azure Storage Explorer on a Linux machine became a necessity, and Microsoft did took the 1st steps into providing one.
Though, it wasn’t very easy to figure out how this works..
After many trials, I’ve managed to put together the instructions below, which will allow you to have your Azure Storage Explorer running on Linux.
Prerequisites
- A Ubuntu machine (I opted for an Azure deployed one; see instructions here)
- A desktop environment (GUI) running on the Linux machine. I went for MATE-Desktop due to it’s easy to use, stability and also personal preference. You may choose differently, of course.
- A way to connect to the GUI of your VM. We will do this via xRDP, just for the sake of demoing this(see note below).
- The .NET libraries for the Linux box, needed by Azure Storage Explorer
NOTE:
xRDP is not a secure mean of connecting to the Linux VM, as it doesn’t allow for SSH Keys. You can, however, tunnel your connection and use a SSH Key authentication for that. A nice how-to is available here.
So, while I will explain using the insecure method, I strongly recommend you to never expose your VMs to internet with just a password protected account, or, if you do that, make sure you do have a uncommon account name and a very strong password.
Of course, you can use your own on premises Linux Box, or a local VM, or some other Cloud provider; this is all up to you.
Considering that, let’s start:
[tabs title=”Install Desktop Environment“][tab title=”Install MATE-Desktop”]
# Install the MATE-Desktop sudo apt update sudo apt install -y ubuntu-mate-desktop sudo reboot
After reboot:
# Install and configure the xRDP sudo apt install -y xrdp sudo sed -e 's/^new_cursors=true/new_cursors=false/g' -i /etc/xrdp/xrdp.ini sudo systemctl enable xrdp sudo systemctl restart xrdp
Create ~/.xsession and ~/.xsessionrc
echo "mate-session" > ~/.xsession XDG_DATA_DIRS=/usr/share/mate:/usr/share/mate:/usr/local/share XDG_DATA_DIRS=${XDG_DATA_DIRS}:/usr/share:/var/lib/snapd/desktop
cat <<EOF > ~/.xsessionrc
export XDG_SESSION_DESKTOP=mate
export XDG_DATA_DIRS=${XDG_DATA_DIRS}
export XDG_CONFIG_DIRS=/etc/xdg/xdg-mate:/etc/xdg
EOF
[/tab]
[tab title=”Install Xfce”]
To install Xfce, please use the following commands:
sudo apt update sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils
Installing Xrdp
xRDP package is available in the default Ubuntu repositories. To install it, run:
sudo apt install xRDP
When the installation process is complete, the xRDP service will automatically start. You can verify that xRDP is running by typing:
sudo systemctl status xrdp
By default xRDP uses the /etc/ssl/private/ssl-cert-snakeoil.key file which is readable only by users that are members of the “ssl-cert” group. Execute the following command to add the xrdp user to the group:
sudo adduser xrdp ssl-cert
That’s it. xRDP has been installed on your Ubuntu server.
Configuring xRDP
xRDP configuration files are located in the /etc/xrdp directory. For basic xRDP connections, you only need to configure xRDP to use Xfce.
To do so open the following file in your text editor:
sudo nano /etc/xrdp/xrdp.ini
Add the following line at the end of the file:
/etc/xrdp/xrdp.ini exec startxfce4
Save the file and restart the Xrdp service:
sudo systemctl restart xrdp
[/tab]
[/tabs]
Add a NSG rule in Azure portal for the 3389 port and allow the same port in ufw:
And, in the VM terminal:
sudo ufw allow 3389/tcp
[tabs title=”Install the storage explorer” type=””]
[tab title=”The easy way -Using <snap store>”]
NOTE:
[divider height=”30″ style=”default” line=”default” color=”” themecolor=”0″]
If you install this in XFCE, there’s a confirmed bug in XFCE when running programs installed through snap, preventing the programs to start:
https://bugs.launchpad.net/snappy/+bug/1656340
To easily prevent the bug from happening, just install the keyring package:
sudo apt install gnome-keyring -y
At this point, you can continue with the rest of the steps below.
[divider height=”30″ style=”default” line=”default” color=”” themecolor=”0″]
Snaps can be used on all major Linux distributions, including Ubuntu, Linux Mint, Debian and Fedora.
Snap is pre-installed and ready to go on the following:
- Any recent Ubuntu release:
- Ubuntu 16.04.4 LTS (Xenial Xerus) or later, including Ubuntu 18.04 LTS (Bionic Beaver), Ubuntu 18.10 (Cosmic Cuttlefish), Ubuntu 19.04 (Disco Dingo) and Ubuntu 19.10 (Eoan Ermine)
- Most recognised Ubuntu flavours built on one of the above Ubuntu releases (an exception is Lubuntu, see below)
- Solus 3 and above
- Zorin OS
If you’re using a desktop, a great first step is to install the Snap Store app.
Storage Explorer was added to the snap store, therefore you can install it by simply:
sudo snap install storage-explorer
The result will look like:
Storage Explorer requires the use of a password manager, which may need to be connected manually before Storage Explorer will work correctly. You can connect Storage Explorer to your system’s password manager with the following command:
snap connect storage-explorer:password-manager-service :password-manager-service
At this point you can simply open the Storage Explorer on you Linux box:
[highlight background=”yellow” color=”red”]NOTE:[/highlight]
[highlight background=”yellow” color=”red”]One issue I encountered here was that Storage Explorer was unresponsive after I logged in, until I rebooted the Linux box.[/highlight]
[highlight background=”yellow” color=”red”]After the reboot, there were no problems noticed.[/highlight]
Locate Storage Explorer Shortcut:
Login to Storage Explorer:
View your subscriptions and files:
[/tab]
[tab title=”The <old>, hard way”]
Install .NET
# Install .NET prerequisites sudo apt install -y liblttng-ust0 libcurl4 libssl1.0.0 libkrb5-3 zlib1g libicu60 # Set the repositories for .NET packages curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list' # Do the install sudo apt-get install apt-transport-https sudo apt-get update sudo apt-get install dotnet-sdk-2.2
Check installed version with:
dotnet --version
Azure Storage Explorer Installation
Install required dependency for Azure Storage Explorer:
sudo apt-get install -y libgconf-2-4 libgnome-keyring-common libgnome-keyring-dev libgconf-2-4 libcanberra-gtk0 libgnome-keyring0
Connect to the VM via RDP with your default username (must be configured with password). Open a browser and download Azure Storage Explorer binaries from: https://azure.microsoft.com/en-au/features/storage-explorer/ Be sure to select Linux from the drop-down. The file will be saved by default in your /home/username/Downloads directory, where “username” will correspond to your actual username.
Downloading the Azure Storage Explore:
[one]
[/one]
Go back to the SSH terminal and paste the following (as a block of text):
cd ~/Downloads && \ sudo mkdir -p /opt/StorageExplorer-linux-x64 && \ sudo tar -C $_ -zxvf StorageExplorer-linux-x64.tar.gz && \ sudo ln -s /opt/StorageExplorer-linux-x64/StorageExplorer /usr/bin/StorageExplorer
Create Storage Explorer Ubunutu/KDE Desktop Resource (paste again as a block of text):
mkdir -p ~/.local/share/applications && \ cat > ~/.local/share/applications/StorageExplorer.desktop <<EOL [Desktop Entry] Encoding=UTF-8 Name=Storage Explorer Exec=StorageExplorer Icon=/opt/StorageExplorer-linux-x64/resources/app/out/app/icon.png Terminal=false Type=Application Categories=Development; EOL
Reboot the VM:
sudo reboot
Back to the xrdp session, start the Azure Storage Explorer.
If the Azure Storage Explorer doesn’t show up on Desktop, you’ll find the startup link under Menu -> Programming. You can further create a Desktop shortcut.
NOTES: If prompted, anywhere during the above steps to create a keyring password, make sure you use one that you’ll remember (you can use the same password as for the username you are logged in with, eventually).
Open Azure Storage Explorer and connect with your account.
Patching Storage Explorer for newer versions of .NET Core If you have a version of .NET Core greater than 2.0 installed and are running Storage Explorer version 1.7.0 or older, you will most likely need to patch Storage Explorer by completing the following steps:
Download version 1.5.43 of StreamJsonRpc from https://www.nuget.org/packages/StreamJsonRpc/1.5.43 via browser on the Linux machine. Look for the “Download package” link on the right hand side of the page. After downloading the package, change its file extension from .nupkg to .zip and unzip it:
cd ~/Downloads && \ mv streamjsonrpc.1.5.43.nupkg streamjsonrpc.1.5.43.zip unzip streamjsonrpc.1.5.43.zip[/sourcecode]
Copy StreamJsonRpc.dll to the following locations inside the Storage Explorer folder:
cd lib/netstandard1.1/ sudo cp StreamJsonRpc.dll /opt/StorageExplorer-linux-x64/resources/app/ServiceHub/Services/Microsoft.Developer.IdentityService/ sudo cp StreamJsonRpc.dll /opt/StorageExplorer-linux-x64/resources/app/ServiceHub/Hosts/ServiceHub.Host.Core.CLR.x64/
Reboot the VM before trying to start Azure Storage explorer again.
[/tab]
[/tabs]
Enjoy!