DEV Community

Cover image for How to Control Storage Access in Azure
Taiwo Olabode
Taiwo Olabode

Posted on

How to Control Storage Access in Azure

Meaning of How to Control Storage Access in Azure:
Controlling storage access in Azure involves using the Azure Portal to manage permissions through Microsoft Entra ID, Shared Access Signatures, access keys, firewalls, virtual networks, attribute-based access control, and anonymous access settings for blobs and file shares, ensuring secure data access by assigning roles, setting temporary access, restricting networks, and following best practices like minimizing permissions and regularly reviewing settings.
We’ll complete several tasks related to managing a storage account and the components of a storage account.
The Azure admin wants us to get more familiar with storage accounts, containers, and file shares. They anticipate needing to share an increasing number of files and need someone who is skilled using these services. They’ve given us the task of creating a storage container and a file share and uploading files to both locations.

In this article, we will be focusing on:

Create a storage container

  • Login to Microsoft Azure at https://portal.azure.com

  • From the Azure portal home page, in the search box, enter storage accounts.

  • Select storage accounts under services.

  • Select the storage account you created in the Prepare exercise. The storage account name is a hyperlink to the storage account. (Note: this should be associated with the resource group guided-project-rg.)

  • On the storage account blade, under the Data storage submenu, select Containers.

  • In the Name field, enter storage-container.

  • Select Create.

Great! With a storage container created, you can upload a blob to the container. Locate a picture that you can upload, either on your computer or from the internet, and save it locally to make uploading easier.

Upload a file to the storage container

  • Select the storage container you just created.

  • Select Upload and upload the file you prepared.

  • Once the file is ready for upload, select Upload.

With the file uploaded, notice that the Access tier is displayed. For something we uploaded just for testing, it doesn’t need to be assigned to the Hot access tier. In the next few steps, you’ll change the access tier for the file.

Change the access tier

  • Select the file you just uploaded (the file name is a hyperlink).

  • Select Change tier.

  • Select Cold.

  • Select Save.

Note: You just changed the access tier for an individual blob or file. To change the default access tier for all blobs within the storage account, you could change it at the storage account level.

  • Select Home to return to the Azure portal home page.

Good job! You’ve successfully uploaded a storage blob and changed the access tier from Hot to Cold. Next, you’ll work with file shares.

Create a file share

  • From the Azure portal home page, in the search box, enter storage accounts.

  • Select storage accounts under services.

  • Select the storage account you created in the Prepare exercise. The storage account name is the hyperlink to the storage account. (Note: it should be associated with the resource group guided-project-rg.)

  • On the storage account blade, under the Data storage submenu, select File shares.

  • Select + File share.

  • On the Basics tab, in the name field enter file-share.

  • On the Backup tab, uncheck Enable backup.

  • Select Review + create.

  • Select Create.

  • Once the file share is created, select Upload.

  • Select Home to return to the Azure portal home page.

The next piece of the puzzle is figuring one way to control access to the files that have been uploaded. Azure has many ways to control files, including things like role-based access control. In this scenario, the Azure admin wants you to use shared access tokens or keys.

Create a shared access signature token

  • From the Azure portal home page, in the search box, enter storage accounts.

  • Select storage accounts under services.

  • Select the storage account you created in the Prepare exercise.

  • On the storage account blade, select Storage browser.

  • Expand Blob container (Note: Blob container is another name for the storage containers. Items uploaded to a storage container are called blobs)

  • Select the ellipses (three dots) on the end of the line for the image you uploaded.

  • Select Generate SAS. (Note: When you generate a shared access signature, you set the duration. Once the duration is over, the link stops working. The **Start automatically populates with the current date and time.)

  • Set Signing method to Account key.

(Tip: There are two signing keys available. You can choose either one, or create SAS tokens with different durations)

  • Set Stored access policy to None.

  • Set Permissions to Read.

  • Enter a custom start and expiry time or leave the defaults.
    (Tip: You can configure SAS tokens for files shares and blob containers using the same process.

  • Select Home to return to the Azure portal home page.

With the SAS token created, anyone with that link can access the file for the duration that was set when you created the SAS token. However, controlling access to a resource or file is about more than just granting access. It’s also about being able to revoke access. To revoke access with a SAS token, you need to invalidate the token. You invalidate the token by rotating the key that was used.

Rotate access keys

  • From the Azure portal home page, in the search box, enter storage accounts.

  • Select storage accounts under services.

  • Select the storage account you created in the Prepare exercise.

  • Expand the Security + networking submenu.

  • Select Access keys.

For Key 1, select Rotate key.

  • Read and then acknowledge the warning about regenerating the access key by selecting Yes.

  • Once you see the success message for rotating the access key, go back to the window or tab you used to check the SAS token and refresh the page. You should receive an authentication failed error.

Congratulations! You’ve completed this exercise. Return to Microsoft Learn to continue the guided project.

Top comments (1)

Collapse
 
zube profile image
Alioke Emmanuel Nzubechukwu

Nice