Azure Storage Explorer on Linux

Linux and CIFS files permissions
July 27, 2018
Show all

Azure Storage Explorer on Linux

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:

# 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

Add a NSG rule in Azure portal for the 3389 port and allow the same port in ufw:

image

And, in the VM terminal:

sudo ufw allow 3389/tcp

Finally, 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.

image
Downloading the Azure Storage Explore
image
Saved file location

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.

image

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:

[sourcecode language="shell"]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/[/sourcecode]

Reboot the VM before trying to start Azure Storage explorer again.

Marin Nedea
Marin Nedea
I'm passionate about open source software and technologies. In my spare time I build simple and functional websites from scratch, using PHP+HTML5+CSS3+MySQL and when I'm bored, I write simple PHP_CLI or bash scripts to play around on my Linux machine.

Leave a Reply

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close