DEV Community

Cover image for How to control storage access.
EMMANUEL
EMMANUEL

Posted on

How to control storage access.

An Azure Storage Account is a fundamental service in Microsoft Azure that provides durable, scalable, and secure cloud storage for a wide range of data types. It allows you to store blobs, files, queues, tables, and disks, which can be used by your applications, VMs, or other Azure services.
Azure Storage Access it is how to access data in storage account. Accessing Azure Storage depends on what kind of data you're trying to access (e.g., blobs, files, queues) and how secure or flexible you want that access to be.

In this article, I will complete several tasks related to managing a storage account and components of the storage account. In a scenario where the Azure admin wants you 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 you a task of creating a storage container and a file share and uploading files to both locations.

Create a storage container
To create a storage container, we follow the necessary steps.

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

Azure login

2.From the Azure portal home page, in the search box, enter storage accounts. Select storage accounts under services

storage account portal search

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

Guided project storage account

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

Containers

5.Select + Add container

+ Add container

6.In the Name field, enter storage-container.

Storage container

7.Select Create.

Create

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.
To Upload a file to the storage container

A. Select the storage container you just created

Storage container

B. Select Upload and upload the file you prepared

Upload

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

Upload

Upload successful

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, so let's change the access tier for the file.

Change the access tier

A. Select the file you just uploaded

Uploaded file

B. Select Change tier.

Change tier

C. Select Cold. Select Save

Cold tier and saved

After 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
1.From the Azure portal home page, in the search box, enter storage accounts. Select storage accounts under services.

Storage accounts

2.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.)

Storage account

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

File share

4.Select + File share

+File share

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

Fileshare

6.On the Backup tab, uncheck Enable backup.

Uncheck enable backup

7.Select Review + create

Review + create

8.Select Create.

Create

9.Once the file share is created, select Upload

Upload

10.Upload the same file you uploaded to the blob storage or a different file, it’s up to you.

File upload

Successful upload

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

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

Portal search storage account,

2.Select storage accounts under services. Select the storage account you created in the Prepare exercise

Storage account prepared in the exercise

3.On the storage account blade, select Storage browser

Storage browser

4.Expand Blob containers

Blob containers

5.Select the storage container you created earlier, storage-container

Storage accounts

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

Ellipses three dots

7.Select Generate SAS

Generate SAS

8.Set Signing method to Account key. Also set Signing key to Key 1

Signing method and key

9.Set Stored access policy to None. Set Permissions to Read

Stored access policy and permission

10.Enter a custom start and expiry time or leave the defaults

Custom start and expiry time

11.Set Allowed protocols to HTTPS only. And select Generate SAS token and URI

Allowed protocols and generate SAS token and URI

12.Copy the Blob SAS URL and paste it in another window or tab of your browser. It should display the image you uploaded. Keep this tab or window open.

Blob SAS URL

Display of uploaded image

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

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

Storage accounts

2.Select storage accounts under services. Select the storage account you created in the Prepare exercise

Guidedstorageaccountemma

3.Expand the Security + networking submenu. Select Access keys

Access keys

4.For Key 1, select Rotate key.

Rotate keys

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

Regenerating access keys

Successful regenerating keys

6.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

Authentication failed error

Top comments (1)

Collapse
 
realcloudprojects profile image
SKILL.SCH

Nice