Azure Files using azurectl | SUSE Communities

Azure Files using azurectl

Share
Share

As a Linux desktop user, I wanted to find a way to use Azure files. There were a few options for creating an Azure Files Share. Unfortunately for me, none of them met my narrow view of acceptable software. I didn’t want to install a Windows client. I didn’t want to use Node.js. I wasn’t capable of using the Rest API directly.

So, I asked my team about their thoughts on how to accomplish creating a Files Share. I was glad to hear that they were already contributing to a python based software that could be extended to do what I needed. Azurectl is an Open-source Python command line tool.

In order to use azurectl I needed 3 things. I needed an Azure account, an Azure Storage account, and an Azure container. You can create an account by visiting the accounts page. After you have created an account you can log into the web interface and get started.

Under the storage tab there is a “new” button. This is where you will create your Storage account. Remember the name as you will need it when creating the Azure Share.

When the account has finished creating you can add a Storage Container. This can be found by clicking on your storage account, and selecting the container tab. Then select “Create a Container”.

Now we can setup azurectl. The project can be found on github. After installing Azurectl we can download the publishsettings file by going here. Then run the following, changing the variables to meet our environment.

azurectl setup account add \
  --name default \
  --publish-settings-file /path/to/publish/settings/file \
  --storage-account-name <accountname> \
  --container-name <containername>

After azurectl has been configured we can create the share.

azurectl compute storage share create –name=<sharename>

Yay, We have a File Share. What do we do with it? I decided to launch a couple SLES12 instances and attach the disk.

To attach the disk, we need to make sure we have the samba client installed. For SLES I ran “zypper in samba-client”. It took me a little while to get the mount command to work. I eventually realized that I had to specify the version in the mount command options. My mount command eventually looked like this.

mount.cifs //<accountname>.file.core.windows.net/<sharename> <somedirectory> -o vers=2.1,username=<accountname>

After creating a couple servers, we can share data between any of them. As long as they are in the same region of course.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

No comments yet

Avatar photo
5,768 views