Creating Private Storage in Microsoft Azure
Tags: azure, cloud, cloudstorage, microsoft
Published: 2024-07-04 22:26:22

We'll be going over creating a storage account and adding files for private access. Feel free to look at my many posts discussing how to do this if you're confused.

1. **Create a Storage Account and Configure High Availability**
   - Ensure Geo-redundant storage (GRS) is selected when creating your storage account.
   - Once your storage account is created, navigate to the resource.
    ![Creating the storage account](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oebhtb7cquns98h7jo6p.jpg)

2. **Create a Storage Container, Upload a File, and Restrict Access**
   - Locate the **Data storage** section and select **Containers**.
    ![Locating Containers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aviny8unxfd3m2y1zqmi.jpg)
   - Click **+Container**, create a name for your container, then click **Create**.
    ![Creating the Container](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/56y9524buno2edbbjh9j.jpg)
   - Navigate to your created container, click **Upload**, add a file, and click **Upload**.
    ![Uploading a file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ehgjd23z80246gqr1z02.jpg)
   - Click the file you uploaded, copy the URL link, and paste it into your browser to confirm you're unable to view the file.
    ![Copying the blob link](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ydrdtnaxg6kfc11d41c8.jpg)
    ![Verifying the file in inaccessible](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hsbmwcpg8rwo7o2cqero.jpg)

3. **Configure Access with a Shared Access Signature (SAS)**
   - Go back to your file and click on **Generate SAS**.
    ![Clicking Generate SAS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/brkmv2lv1mwt89y4kilu.jpg)
   - Set permissions to **Read** and adjust the **Expiry** to 24 hours from the current time.
   - Click **Generate SAS token and URL**.
    ![Configuring expiration time](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bzvvzw8uuwsd3qmt1qs8.jpg)
   - Copy the generated Blob SAS URL and paste it into your browser to verify access.
    ![Copying the URL](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/958z9mvireezyp64puld.jpg)
    ![Viewing the uploaded file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8myd7d790rc92hguqn6y.jpg)

4. **Configure Storage Access Tiers and Content Replication**
   - Move blobs from the Hot tier to the Cool tier after 30 days to optimize costs.
   - Navigate back to the overview of your Storage Account.
   - Locate **Lifecycle Management** under **Data Management**.
    ![Changing the lifecycle](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9kjyiu0wpy7n1pc1nhaf.jpg)
   - Click **Add a rule**.
    ![Locating the Lifecycle Rules](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nsy8ray8klflsq31w4r7.jpg)
   - Create a name for your rule, leave other settings as default, and click **Next**.
    ![Naming the rule](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgrxngqnebu1q15r92pj.jpg)
   - Set the if condition to **Last Modified** and change **More than (days ago)** to **30**.
   - Change the then condition to **Move to cool storage** and click **Add**.
    ![Creating the rule conditions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6y7bzvzcnop1opsrpd2w.jpg)

We've now configured a lifecycle policy for our private files.

Remember to delete all resources once you're done.