Private Data / Public Data Backup - Azure Files and Azure Blobs
Tags: azure, data, blobs
Published: 2024-05-25 03:21:39

## Create a storage account and configure high availability.
### Create a storage account for the internal private company documents.
_In the portal_, _search_ for and _select_ **Storage accounts**.
![search](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q4urmdzxofkjzxw0e8lo.png)
_Select_ + **Create**.
![select](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i2qo5ej14yekty9w95e5.png)

_Select_ the **Resource group** _created_ in the previous lab.
_Set_ the **Storage account** name to private. Add an identifier to the name to ensure the name is unique.

![identifier](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y7ucgivysoj6css3tmv1.png)



_Select_ **Review**, and then **Create** the storage account.

![Review and Create](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vm5mi11fqe5ii5erqk4k.png)

Wait for the **storage account** to _deploy_, and then _select_ Go to **resource**.

![Resources](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/stey1qnz3mkc6g0brw5j.png)


_This storage requires high availability if there’s a regional outage._ Read access in the secondary region is not required. Configure the appropriate level of redundancy.

In the _storage account_, in the **Data management** section, _select_ the **Redundancy blade**.
_Ensure_ **Geo-redundant storage (GRS)** is selected.
_Refresh_ the page.
_Review_ the primary and secondary location information.
_Save_ your changes.

![Geo-redundant storage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ho2ongefwg3ety51ateq.png)

### Create a storage container, upload a file, and restrict access to the file.
_Create_ a _private storage container_ for the corporate data.

![private storage container](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1ye9v6l67qiawkuu5bln.png)




In the _storage account_, in the **Data storage** section, _select_ the **Containers** blade.
_Select_ + _Container_.
_Ensure_ the Name of the container is **private**.
![private storage container](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0t6xzbbw4rpkpo4f6aqb.png)
_Ensure_ the **Public** access level is **Private (no anonymous access)**.
As you have time, review the Advanced settings, but take the defaults.
_Select_ **Create**.
For testing, upload a file to the private container. The type of file doesn’t matter. A small image or text file is a good choice. Test to ensure the file isn’t publically accessible.

_Select_ the **container**.
_Select_ **Upload**.
![Upload](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xatv5x7kfq6vax4l39y8.png)
Browse to files and select a file.
Upload the file.
![Uploaded](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hvjowguvu3ixh7mqh1gx.png)

_Select_ the **uploaded file**.
On the **Overview tab**, _copy_ the **URL**.
![Private Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jbfaeaumioqoonxbbp8e.png)


_Paste_ the **URL** into a **new browser tab**.
_Verify_ the file doesn’t display and you receive an error.
![Verification Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/083qybv3fhezcgd1iyv8.png)


### An external partner requires read and write access to the file for at least the next 24 hours. Configure and test a shared access signature (SAS). 
_Select_ your uploaded **blob file** and move to the **Generate SAS** tab.
![Genetate SAS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6m04n34ww0fttdlw8dcd.png)
In the **Permissions** drop-down, _ensure_ the partner has only **Read permissions**.
_Verify_ the **Start** and **expiry date/time** is for the next **24 hours**.
_Select_ **Generate** **SAS token and URL**.
![SAS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4q19dh4jmunhr9vhrpja.png)
_Copy_ the **Blob SAS URL** to a _new browser tab_.
![Blob SAS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xty5ze8ljjdkikl6kqvm.png)
_Verify_ you can _access_ the file. If you have uploaded an image file it will display in the browser. Other file types will be downloaded.
![file downloaded](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uk92srj3kgl2uithsqy9.png)

### Configure storage access tiers and content replication.
#### To save on costs, after 30 days, move blobs from the hot tier to the cool tier. 

_Return_ to the **storage account**.
In the **Overview section**, notice the **Default access tier** is set to **Hot**.

![Hot](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/omftlaahlg7x9iy0rw1k.png)


In the **Data management** section, _select_ the **Lifecycle management** blade.

![Data Management](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/akfdctqbw2nsmz0zp62i.png)


_Select_ Add **rule**.
_Set_ the **Rule name** to movetocool.
_Set_ the Rule scope to **Apply rule** to **all blobs in the storage account**.
_Select_ **Next**.
![Rule name](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/362dljya2hr0tc3q0war.png)




_Ensure_ **Last modified** is selected.
_Set_ More than (days ago) to **30**.
In the **Then** drop-down select **Move to cool storage.**

> As you have time, review other lifecycle options in the drop-down.
_Add_ the **rule**.


![Add rule](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1khpn0p6h0qfmikyrgwu.png)

#### The public website files need to be backed up to another storage account. 

In your **storage account**, _create_ a new container called **backup**. _Use_ the default values. 

![backup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ctrtft4qv14scvrg4o7g.png)


_Navigate_ to your [publicwebsite storage account](https://dev.to/olawaleoloye/working-with-mission-critical-data-azure-files-and-azure-blobs-26p3). _This storage account was created in the previous exercise_.

In the **Data management section**, _select_ the **Object replication** blade.
_Select_ **Create replication rules**.

![Create replication rules](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/54fy62lewrxs2x877uwa.png)


_Set_ the **Destination storage account** to the **private storage account**.
_Set_ the **Source container** to **public** and the **Destination container** to **backup**.
_Create_ the **replication rule**.

![replication rule](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/11tt0i2yvnyanjvdew3z.png)

![replication created](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/my5p0ravnpij8xn6qd53.png)

Optionally, as you have time, **upload a file to the public container**. 

![public upload](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o6rdytwvpdqx44mjq1v0.png)

![public uploaded](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4lg6ig1fauxjdezsthdg.png)



_Return_ to the **private storage account** and _refresh_ the **backup container**. _Within a few minutes your public website file will appear in the backup folder._

![back up](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5smuklmrikbario2r9fz.png)