Tag Archives: ARM

Backup ARM VMs in Azure | Tips & tricks

As you already know Microsoft Azure Fabric is now in version 2 which is sometimes referred to as Azure Resource Manager (ARM) deployment model. Most of the services from old Azure Service Management model are now available in the new model (the new portal) and today we are going to see how we can backup VMs deployed using ARM deployment model using a Azure Recovery Services Vault.

Note that you may notice another two services in your Azure subscription called Backup vaults & Site Recovery vaults which are redundant and has no use. (They are just placeholders which will be removed soon I assume)

Backup ARM VMs (1)

Essentially following scenarios are supported in a new Recovery Services vault. If you are using premium storage accounts for your VMs  keep in mind that it is only supported in a public preview and not generally available as of yet.

  • Azure Resource Manager VMs
  • Classic VMs

The process can be done in few easy steps.

Creating a Recovery Services Vault

A Recovery Services vault holds all the backups and recovery points of the VMs that are being protected along with the backup policy applied to that vault.  One important thing to keep in mind is that Recovery Services Vaults are geo specific, meaning if you need to backup a VM in one region the target vault should reside in the same region as well.

In the Hub menu, click Browse and then search for Recovery Services. I’ve already added it as a favorite by clicking the star right next. Then select Recovery Services vault and click Add.

Backup-ARM-VMs-2.png

Provide a name, select the target Azure subscription, create a new resource group or select an existing one and finally select the region for your Recovery Services vault.

Backup-ARM-VMs-3.png

Next you can select the storage replication option. The default is Geo-redundant storage and if you want a cheaper (but not durable as Geo-redundant) option you can opt out for locally-redundant storage.  Click the All Settings option in your vault dashboard to get started.

Backup-ARM-VMs-4.png

Select a Backup Target

You need to discover your Azure ARM VMs first before they are added to a recovery services vault. This will identify the VMs that can be protected by your recovery services vault.

Backup-ARM-VMs-5.png

Define a Backup Policy

A backup policy defines how frequent the VMs are protected and when the recovery points are created along with the retention range for those recovery points. You can edit the default policy to fit to your needs or create new policy here. You can choose between a daily or weekly schedule to backup your VMs.

Backup-ARM-VMs-6.png

Next select the desired VMs that you wish to backup and finally click Enable Backup.

Backup-ARM-VMs-7.png

Backup-ARM-VMs-8.png

Start the Initial Backup

By default the first scheduled backup is the initial backup. If you want to manually force the first backup it is also possible. In the vault dashboard click Azure Virtual Machines and right click on the desired VM and select Backup Now.

Backup-ARM-VMs-9.png

You can see the backup job progress by clicking All Settings > Jobs > Backup Jobs as below from the vault dashboard.

Backup-ARM-VMs-10.png

When you further expand the backup job you can see the status of each task running underneath.

Backup-ARM-VMs-11.png

SOS for Azure VMs with Set-AzureRmVM

“Save Our Souls” is the International distress call for help in maritime operations. Over the years SOS has become more common term to imply a call for help in a disastrous situation. In Microsoft Azure sometime you may have faced such situations especially with IaaS VMs. For an example RDP not working in a Windows VM or SSH ceased to function in a Linux VM. When all hope is lost you may contact Azure Support or try to restart the VM (from Azure Portal) or resize the VM as a last resort.

Now going into all of the above troubles is no longer required to rescue your Azure IaaS VMs. The latest Microsoft Azure PowerShell cmdlet improvements allows you to redeploy your virtual machine when you invoke a redeploy operation through Azure PowerShell.

Important

  • Below cmdlet works only with Azure Resource Manager based VMs.
  • Latest version of Azure PowerShell needs to be installed in the management PC from which you are invoking the redeploy operation.
  • Dynamic IP addresses will be changed after completing the redeploy operation.
  • Data on local disks (ephemeral storage) will be lost.

Following is the syntax for the updated Set-AzureRmVM cmdlet. Note that the -Redeploy switch is used to invoke a redeploy operation.

SetAzureRmVM Redeploy ResourceGroupName $rgname Name $vmname

The VM status changes from Running > Updating > Starting > Running during the operation. The final Running status means that VM has been successfully redeployed.

For a complete reference of the Set-AzureRmVM cmdlet please refer here.

Creating a SQL Database V12 Server in Azure

Few days ago my friend Business Solutions (Dynamics NAV) MVP Tharanga Chandrasekara came up with an interesting question. Creating a logical server for SQL Azure DB (PaaS) in the old Azure Service Management Portal is possible but why can’t we do that in the new Azure Resource Manager Portal. To find out what is happening I tried exploring the SQL PaaS option in the ARM portal.

When we create a new SQL database in the ARM portal we can create a logical server along with it as below.

SQL V12 1

But somehow when we checked two days back there was no Add button under SQL servers. We have tried the same thing in several Azure Subscriptions but there was no luck.

SQL V12 3

But today I checked again the same thing in one of my subscriptions and could see the Add button and could create a server without any problem.

SQL V12 2

Nothing out of the ordinary was mentioned in any forum as well and Tharanga has posted a question in User Voice. We were hoping the PG can shed some light into this. Whether it was a glitch on certain subscriptions or actually missing feature until now.

This led me to explore how to do this in ARM using PowerShell.

  • First you need to install the new Azure PowerShell module to start with. You can refer this to understand how to do so.
  • Then you can execute below cmdlets in Azure Powershell to login to your Azure Subscription and choose the exact subscription (if you have many Azure subscriptions under one account)

Add-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId <Subscription ID>

  • Not all resources in ARM are available in all regions so it is always better to check whether the V12 database servers are available in the region you were planning to deploy.

(Get-AzureRmLocation | where-object {$_.Name -eq “Microsoft.Sql/servers” }).Locations

  • Next step is to create  a resource group in your desired region. I chose East US.

New-AzureRmResourceGroup -Name “jcbv12sql-RG” -Location “East US”

  • Then you can create the SQL V12 server and add firewall rules to allow any connections from outside Azure.

New-AzureRmSqlServer -ResourceGroupName “jcbv12sql-RG” -ServerName “jcbv12svr01” -Location “East US” -ServerVersion “12.0”

New-AzureRmSqlServerFirewallRule -ResourceGroupName “jcbv12sql-RG” -ServerName “jcbv12svr01” -FirewallRuleName “exrule1” -StartIpAddress “<First IP Address>” -EndIpAddress “<Last IP Address>”