0845 643 64 63

Backup

Azure Backup for Virtual Machines

Configuring Backups

Backups are configured for each VM individually, selecting their own retention policies and routines. They can however utilise the same storage and vaults.

1. Select the Backup option under “Operations” in the sidebar of the VM management page, on https://portal.azure.com/

2. Give your backup Vault a name, (where the backups will be stored), and select the resource group you’d like it to be in.

3. Select Edit this policy, (or select a policy if you’ve already configured one you want). Give the policy a better name and set the schedule.

4. Set the Instant Restore duration. (This retains snapshots along with the disks to allow for a faster restore).

5. Choose your different retentions as required. (Only daily or a variety of all?)

6. Optional! Azure creates a resource group for the Instant Recovery points. Enter your own name if you wish.

7. Click OK and then click Enable Backup.

8. Navigate back to the same location after the backup should have taken place, to confirm that you have backups as you’d expect. (Screenshot from an existing backup routine that runs at 7:30pm).

Restoring backups

There are two options when restoring, “Create new” or “Replace existing”. I’ll go over both options below, (the first few steps are the same).

Azure Storage Account (Gen1)

1. Select the Backup option under “Operations” in the sidebar of the VM management page, on https://portal.azure.com/

2. Select the Restore VM option from the top bar.

3. Click Select to choose your restore point.

4. Select the one you wish to restore and click OK.

5. Select your Restore Configuration, either Create new (6. onwards) or Replace existing (8. onwards).

Create new

6. a. Select Restore Type “Create new virtual machine”. (This will create a whole new VM with the same setup as the previous backup, including all disks).

  • Type unique Virtual machine name
  • Select Resource group
  • Select Virtual network
  • Select Subnet
  • Select Staging Location (This is where the data will be copied to out of the backup vault, while the resources are created).

6.b. Select Restore Type “Restore disks”. (This will restore the disks to your resource group that you can then swap out for the existing disks on an existing VM).

  • Select Resource group
  • Select Staging Location (This is where the data will be copied to out of the backup vault, while the resources are created).

7. Select Restore

Replace existing

8. (This will replace the disks on the existing VM, but it will take a new snapshot of that VM before it replaces them).

  • Select the Staging Location. (This is where the data will be copied to out of the backup vault, while the resources are created).

9. Select Restore

After Restore

Create new

a. If you created a new VM, you’ll now need to log in and disable anything that you don’t want running. (Think overnight ETL etc).
b. If you created new disks, you’ll now need to edit an existing VM and replace the disks by going to “Disks” on the VM and selecting the restored disks. (You can swap and swap back easily, so this can be used to pull files from a previous day).

Replace existing

This will take a snapshot of the existing disks before replacing them, so if you want to undo the replacement, you’ll need to go through the restore process again, replacing with that newer restore point.

If you have any questions about the process, please comment below!

Azure Storage Backup Retention

This blog is a follow up to a previous blog I wrote about backing up Azure Analysis Services cubes in Azure, that blog can be found here. This blog shows how to implement a retention policy using PowerShell in Azure Runbooks to remove the backups after a set number of days. To create a new Runbook in the Azure portal, go to the relevant Automation account in the relevant resource group and then select Runbooks from the left hand pane. Note you will need to add the Az.Storage module to the automation account to be able to use some of the commands listed in this blog.

The parameters required here are shown below, where ResourceGroupName is the name of the resource group that has the relevant storage account, StorageAccountName is the name of the storage account resource and ContainerName is the name of the container holding the backup files to be removed. BlobName is part of the name of the files and will be used later to obtain only the relevant files from the storage container. RetentionDays specifies the number of days to keep a backup before it is removed.

The command Set-AzCurrentStorageAccount sets the storage account to be used for the subsequent commands, which gets the container using the ContainerName parameter and then lists the relevant files in the blob container using the BlobName parameter.

Once the list of backup files has been obtained, each file can be checked in turn and removed if it meets the relevant criteria. For each file obtained, the LastModified property is used to identify when the file was created. If the resulting date time is older than the number of retention days from today, the Remove-AzStorageBlob command is used to remove that file from the storage container. This check is repeated for all files, removing the relevant files, and leaving only those that are not older than the RetentionDays parameter.

This is all you need to start cleaning up the backup files in Azure, and although I have used Azure Analysis Services backups for my example here, this code can be used for any blob files in Azure.

Azure Analysis Services Cube Backup

This blog is a quick guide on how to back up an Azure Analysis Services cube using PowerShell. The PowerShell is used in a runbook inside an Automation account in Azure to automate the backup process. A pre-requisite for this is to configure the backup storage settings, this details the location of the backups.

Two parameters are passed into the runbook (shown below), where AnalysisServerName is the server name for the analysis services cube and AutomationCredentialName is the name of the credential for the Automation account in Azure.

The following variable is used to store the current date, obtained using the Get-Date cmdlet. This will be used as part of the backup name.

The command Get-AzureAutomationCredential is used to get the credentials for the Automation account provided, in this case it is one of the parameters provided for the runbook. The result is saved to a variable that will be used as a parameter for the backup command.

And finally, the backup command completes the backup of the analysis services cube to a file. Several parameters are used in this command: -BackupFile is the name given to the backup file, -Name is the name of the cube being backed up, -Server is the server name (passed in as a parameter), -Credential is the credentials obtained in the previous step, and -ApplyCompression enables the backup with compression.

I hope you have found this useful! The follow up to this blog about cleaning up the backup files can be found here.

Power BI Sentinel
The Frog Blog

Team Purple Frog specialise in designing and implementing Microsoft Data Analytics solutions, including Data Warehouses, Cubes, SQL Server, SSIS, ADF, SSAS, Power BI, MDX, DAX, Machine Learning and more.

This is a collection of thoughts, ramblings and ideas that we think would be useful to share.

Authors:

Alex Whittles
(MVP)
Reiss McSporran
Jeet Kainth
Jon Fletcher
Nick Edwards
Joe Billingham
Microsoft Gold Partner

Data Platform MVP

Power BI Sentinel
Frog Blog Out
twitter
rssicon