Azure App Service - Backup Code

Most developers deploy code to different environments like Production, Staging, Dev., etc. Each time before we deploy the code, we take backup of the existing code so that it is easy to revert the changes if there are any unexpected errors.

Azure provides an easy way to take the backups of the code. It maintains the history of all of our backups and allows us to restore any of the backups if required.

Please take note that you can take backup only in the Standard (or above) pricing tier. If you try to take a backup for an App Service which is associated with a plan that is lower than Standard, you will get an error message as shown below.



So, please make sure that you create your App Service in the Standard pricing tier or above.



Once the App Service is configured under standard mode, navigate to Settings -> backup blade as shown below



The above screen capture doesn’t display any records in the “All backups” section as we don’t have any backups yet. So, let’s go ahead and configure one.

Click on the “Configure” button to start configuring the backup. All backups of the code will be stored in Azure Blob Container. So, clicking on the “Configure” tab will ask you to create a storage account (if you don’t have one already) along with a blob container. For more details about blobs and containers and other Azure Storage details, please have a look at one of my previous articles.

Once you provide the blob details, you can schedule the backup as shown below.



Schedule backup: Toggle switch to enable/disable the backup. Select “On”.

  • Frequency: Number of times Azure need to take the backup.
  • Unit of Frequency: If you select “Days” and provide “1” in the “Frequency” field, then Azure will take backup once every day.

You can also select start date, time zone and the retention period in days.

Once you select the required details, click on “OK” button and then click on the “Save” button as shown below.



That’s it, you have created a schedule for the App Service.



Azure also maintains the history of the backups as shown below.
.


You can also create a backup manually by clicking on the “Backup Now” button. Clicking on the “Backup Now” will create a backup immediately.

If you would like to restore a particular back up in case of any issues with your recent deployments click on the “Restore Now” button as shown below.



We can also take database backups associated with the App Service which we will discuss in our future articles.

Up Next
    Ebook Download
    View all
    Learn
    View all