Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Azure icon
Labs

Shared Application Configuration with Azure Files

Azure File Shares are a powerful tool for managing data in the cloud. The data stores that uses File Shares can take many forms, and it can even include configuration data. One way to use Azure Files shares is to store shared configuration files in them so that the shared configuration files can be accessed across multiple servers. In this lab, we will explore Azure File shares. We will configure an Nginx web server on two machines using a shared configuration file stored in an Azure File share. This will provide you with some hands-on experience with what it might look like to manage shared configuration using Azure File shares.

Azure icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 30m
Published
Clock icon Feb 14, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create a file share to store the shared configuration file.

    1. Log in to the Azure portal.
    2. Locate the storage account. The name of the storage account should begin with webconfig.
    3. Click on the storage account, then select File Shares and click + File Share to create a new file share.
    4. Set the name of the new file share to config and click Create.
  2. Challenge

    Mount the File share to both web servers.

    1. On both servers, edit the fstab file using sudo vi /etc/fstab.
    2. Add a new entry at the end of the file on each server. Replace the <storage account name> in the Samba address with your real storage account name, which you can find in Azure portal. With it, enter the following:
    //<storage account name>.file.core.windows.net/config /etc/nginx/sites-enabled cifs nofail,vers=3.0,credentials=/etc/smbcredentials/webconfig.cred,serverino
    
    1. On both servers, finish mounting the File Share by mounting all filesystems in fstab using sudo mount -a.
  3. Challenge

    Create the shared configuration file within the file share.

    1. On one of the two servers, edit the config file using sudo vi /etc/nginx/sites-enabled/default.
    2. Add the contents of the configuration file:
    server {
      listen 80 default_server;
      listen [::]:80 default_server;
    
      root /www/satt;
    
      index index.html index.htm index.nginx-debian.html;
    
      server_name _;
    
      location / {
        try_files $uri $uri/ =404;
      }
    }
    
    1. On both servers, reload the Nginx configuration using sudo nginx -s reload.

    You should be able to view the website by accessing either server's public IP address in a browser. You can also verify this when logged in to one of the servers with the curl localhost command.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans