Skip to main content
Jorge Bernhardt Jorge Bernhardt
  1. Posts/

How to create an Azure Recovery Services Vault

·574 words·3 mins· 100 views · 5 likes ·
Azure CLI Azure Cloud Shell Azure PowerShell Get-AzRecoveryServicesVault

This post is part of a series in which I will show how to create different resources in Microsoft Azure. Today I will show you how to create a component that every Azure subscription should have: an Azure Recovery Service vault. You can use Recovery Services vaults to store backup data for various Azure services such as VMs, Azure File shares, Azure SQL databases, and more. This tutorial assumes that you already have a Microsoft Azure account configured.

Azure PowerShell Workaround>

Azure PowerShell Workaround #

If you want to know how to install the PowerShell Azure module on your machine, check out this link. The simplest way to get started is to sign in interactively at the command line.

Login-AzAccount

This cmdlet will bring up a dialog box prompting you for your email address and password associated with your Azure account. If you have more than one subscription associated with your mail account, you can choose the default subscription. To perform this task we will use the following commands:

Get-AzSubscription
Select-AzSubscription -Subscription "My Subscription"

The recovery service vault is a resource and you must place it within a Resource Group. You can use an existing Resource Group or you can create a new Resource Group. If you want to know how to create a Resource Group using Powershell, check out this link. To create a Recovery Service vault with Azure PowerShell, use the New-AzRecoveryServicesVault cmdlet with the following syntax:

New-AzRecoveryServicesVault `
    -Name <String> `
    -ResourceGroupName <String> `
    -Location <String>

Recovery Services Vault
With the Set-AzRecoveryServicesBackupProperties cmdlet in PowerShell, we can specify the type of storage redundancy.

$rsvault = Get-AzRecoveryServicesVault -Name  <String>

Set-AzRecoveryServicesBackupProperties `
    -Vault <ARSVault> `
    -BackupStorageRedundancy <AzureRmRecoveryServicesBackupStorageRedundancyType>

Set-AzRecoveryServicesBackupProperties
-BackupStorageRedundancy: Specify the type of storage redundancy to use.

  • GeoRedundant
  • LocallyRedundant

You can verify the task by running the Get-AzRecoveryServicesVault cmdlet. This cmdlet gets the list of vaults in the Resource Group in the selected subscription.

Get-AzRecoveryServicesVault -ResourceGroupName <String>
Get-AzRecoveryServicesVault
>

Get-AzRecoveryServicesVault
#

Azure CLI Workaround>

Azure CLI Workaround #

You can use it in your browser with Azure Cloud Shell, or install it on your machine. If you want to know how to install the Azure CLI, check out this link. The way to get started is to sign in interactively at the command line.

az login

This command will bring up a dialog box prompting you for your email address and password associated with your Azure account. If you have more than one subscription associated with your mail account, you can choose the default subscription. to perform this task we will use the following commands:

az account list
az account set --subscription "Subscription Name"

The recovery service vault is a resource and you must place it within a Resource Group. You can use an existing Resource Group or you can create a new Resource Group. If you want to know how to create a Resource Group using Azure CLI, check out this link. To create an Azure Recovery Services vault with Azure CLI, use the following syntax:

az backup vault create \
--name <Name> \
--resource-group <ResourceGroup> \
--location <Location>

az backup vault create
With the following commands, we can specify the type of storage redundancy.

az backup vault backup-properties set \
--name <Name> \
--resource-group <ResourceGroup> \
--backup-storage-redundancy

az backup vault backup-properties set
--backup-storage-redundancy: Sets backup storage properties for a Recovery Services vault.

  • GeoRedundant
  • LocallyRedundant

You can check the task by running the following command:

az backup vault list \
--resource-group <ResourceGroup>

az backup vault list
If you want to know more about Azure Recovery Services vaults, check out this link.