# 7 Using N2W with Azure

Following are the steps for setup, backup, and recovery of Azure VMs and Disks:

1. Before starting, configure N2W Backup and Recovery according to [Configuring N2W.](/quick-start/3.-n2ws-server-instance-configuration.md)
2. After the final configuration screen, prepare your Azure Subscription by adding the required permissions and custom IAM role in AWS. See section [7.1](/quick-start/7-backing-up-and-recovering-azure-vms-and-disks.md#7-1-setting-up-your-azure-subscription).
3. In N2W, add an Azure account with the custom N2W role. See section [7.2](/quick-start/7-backing-up-and-recovering-azure-vms-and-disks.md#7-2-adding-an-azure-account-to-n-2-ws).
4. Create an Azure policy in N2W with Azure backup targets. See section [7.3](/quick-start/7-backing-up-and-recovering-azure-vms-and-disks.md#7-3-creating-an-azure-policy).
5. Back up the policy. See section [7.4](/quick-start/7-backing-up-and-recovering-azure-vms-and-disks.md#7-4-backing-up-an-azure-policy).
6. Recover from a backup. See section [7.5](/quick-start/7-backing-up-and-recovering-azure-vms-and-disks.md#7-5-recovering-from-an-azure-backup).

## 7.1  Setting Up Your Azure Subscription

N2W Backup and Recovery needs the following permissions to perform backup and recovery actions. In addition, see&#x20;

1. For the minimal permissions for Azure, see <https://n2ws.zendesk.com/hc/en-us/articles/28833036917021-Required-Minimum-Azure-permissions-for-N2W-operations>
2. Add your subscription ID value to the `subscriptions` attribute in the minimal permissions JSON.

```
{
    "properties": {
        "roleName": "CPM",
        "description": "",
        "assignableScopes": [
            "/subscriptions/<subscriptionID>"
        ],
        "permissions": [
            {
                "actions": [
                    "Microsoft.Compute/virtualMachines/read",
                    "Microsoft.Compute/disks/read",
                    "Microsoft.Compute/snapshots/write",
                    "Microsoft.Network/networkInterfaces/read",
                    "Microsoft.Compute/snapshots/read",
                    "Microsoft.Resources/subscriptions/resourceGroups/read",
                    "Microsoft.Compute/disks/write",
                    "Microsoft.Compute/snapshots/delete",
                    "Microsoft.Resources/subscriptions/resourceGroups/delete",
                    "Microsoft.Network/virtualNetworks/read",
                    "Microsoft.Network/virtualNetworks/subnets/read",
                    "Microsoft.Network/networkInterfaces/write",
                    "Microsoft.Network/virtualNetworks/subnets/join/action",
                    "Microsoft.Network/networkInterfaces/join/action",
                    "Microsoft.Compute/virtualMachines/write",
                    "Microsoft.Compute/diskEncryptionSets/read",
                    "Microsoft.Compute/virtualMachines/powerOff/action",
                    "Microsoft.Compute/virtualMachines/start/action",
                    "Microsoft.Compute/availabilitySets/read",
                    "Microsoft.Compute/availabilitySets/vmSizes/read"
                ],
                "notActions": [],
                "dataActions": [],
                "notDataActions": []
            }
        ]
    }
}

```

&#x20;   2\. In the Azure Portal, go to your subscription. Select a subscription that you want to use with N2W Backup & Recovery. <img src="/files/-M_M-HfqewRv1GRBJfLT" alt="" data-size="line"> \
&#x20;   3\. Select **Access control (IAM)**, select **+Add**, and then select **Add custom role**.

![](/files/-M_LzQ6O68S64ni3cqPD)

\
&#x20;   4\. Complete the form by providing a **Custom role name**, such as **N2WBackupRecoveryRole**, and then select the JSON file saved in step 1.

![](/files/-M_LzpvPcBy_LpeuDpS6)

&#x20;   5\. Create the role with the new JSON file.

## 7.2  Adding an Azure Account to N2W

1. Log on to N2W using the root username and password used during the N2W configuration.
2. Select the **Accounts** tab.
3. If you have a license for Azure cloud, select **Azure account** in the **+ New** menu.  <img src="/files/-M_LrQ1c7CqIO1OzR3KO" alt="" data-size="original">&#x20;
4. Complete the New Azure Account screen using the App Registration view information in the Azure portal as needed. &#x20;

![](/files/J5pY30yoUH20IUt9lXst)

* **Name** - Copy from your App Registration name.
* In the **Use**r list, select your username. Or, select **+ New** to add a new user. See section 18 in the [*N2W Backup & Recovery User Guide*.](https://docs.n2ws.com/user-guide/)
* **Directory (tenant) ID** – Copy from your App Registration.
* **Application (client) ID** – Copy from your App Registration.
* **Client Secret** – Copy from your App registration Certificates & Secrets in the App Registration view, or set a new secret.

&#x20;   5\. Select **Save**. The new account appears in the Accounts list as an Azure Cloud account. &#x20;

![](/files/EiKBPGR8iZ7CEJ6EgUiu)

## 7.3  Creating an Azure Policy

To backup resources in Azure, create an N2W policy.

1. In N2W, select the **Policies** tab.
2. In the **+ New** list, select **Azure policy**.
3. In the New Azure Policy screen, complete the fields:

* **Name** – Enter a name for the policy.
* **User** – Select from the list.&#x20;
* **Account** – Select from the list. Or, select **+ New** to add an account. See section [7.2](/quick-start/7-backing-up-and-recovering-azure-vms-and-disks.md#7-2-adding-an-azure-account-to-n-2-ws).
* **Enabled** – Clear to disable the policy.
* **Subscription** – Select from the list.
* **Schedules** – Optionally, select one or more schedules from the list, or select **+ New** to add a schedule. See section [4.3](/quick-start/4.-creating-a-simple-backup-policy.md#4-3-creating-a-simple-backup-policy).
* **Auto Target Removal** – Select **Yes** to automatically remove a non-existing target from the policy.

&#x20;   4\. Select the **Backup Targets** tab.\
&#x20;   5\. In the **Add Backup Targets** menu, select the targets to backup, Disks and/or Virtual Machines. The Add Virtual Machines / Disks screen opens.\
&#x20;   6\. When selecting Virtual Machines, it is *required* to filter by the **Location** of the target resources using the list in the upper left corner *before* selecting the individual targets. Filtering by Resource Group is optional.

![](/files/L7jScvvjw5sNGmWSgYrG)

&#x20;   7\. When finished selecting targets, select **Add selected**. The Backup Targets tab lists the selected targets.

![](/files/hBmbTjNRNjh0Ik0eZdwK)

&#x20;   8\. To determine which disks for each Virtual Machines target to backup, select<img src="/files/-M_LuGirToFkd3q_SJLp" alt="" data-size="line">**Configure**. In the **Which Disks** list of the Policy Virtual Machine and Disk Configuration screen, select the disks to include or exclude in the backup.\
&#x20;   9\. When finished, in the **Backup Targets** tab, select **Save**.

## 7.4  Backing Up an Azure Policy

If the policy has a schedule, the policy will backup automatically according to the schedule. To run a policy as soon as possible, in the **Policies** view, select the policy and select<img src="/files/-M_LuXrkwH3hrGJnY0-3" alt="" data-size="line">**Run ASAP**.

To view the policy progress and backups, select **Backup Monitor**.

* The backup progress is shown in the **Status** column.&#x20;
* Use the Cloud buttons to display the Azure policies.

![](/files/Dte1ipyTaM354X4nvtL3)

## 7.5  Recovering from an Azure Backup

{% hint style="info" %}
Only one VM is recoverable during a recovery operation.
{% endhint %}

After creating a backup, you can recover it from the **Backup Monitor**.

In the VM recovery Basic Options, there are Azure options for replicating data to additional locations in order to protect against potential data loss and data unavailability:

* **Availability Zone** – A redundant data center (different building, different servers, different power, etc.), within a geographical area that is **managed by** **Azure.**
* **Availability Set** – A redundant data center (different building, different servers, different power, etc.) that can be launched and fully configured by the customer and **managed by the customer.**
* **No Redundancy Infrastructure Required** – By selecting this option, the customer can choose not to replicate its data to an additional (redundant) location in another zone or set. By choosing this option, the customer would save some money, but in rare cases (usually 11 9s of durability and 99.9% of availability), the customer can experience some degree of data loss and availability.

In the Disk Recovery screen, you may be presented with an option to change the encryption when recovering certain disks.

{% hint style="info" %}

* To add an additional layer of encryption during the recovery process, see <https://docs.microsoft.com/en-us/azure/virtual-machines/disks-enable-customer-managed-keys-portal>.&#x20;
* Disk encryption settings can be changed only when the disk is unattached or the owner VM is deallocated.
  {% endhint %}

### 7.5.1  Recovering a VM and Disks

**To recover a VM with or without attached disks:**

<figure><img src="/files/S9kaFBkaEyucZxbehxh6" alt=""><figcaption></figcaption></figure>

1. &#x20;In the **Backup Monitor**, select the backup, and then select ![](/files/pM2kwLb2FhjtsnIB9GtM) **Recover**.

<figure><img src="/files/SfWWVI8YvW8E9jx1SrHh" alt=""><figcaption></figcaption></figure>

&#x20; 2\.  Select the VM snapshot that you want to recover from, and then select ![](/files/aLqttkl4ala2lp8SgeBC) **Recover**.

&#x20; 3\.  In the **Virtual Machines** tab of the Recover screen, select 1 VM, and then select ![](/files/ExUjrNqLVtsIzunEmcdI) **Recover**. The **Basic Options** tab opens.

<figure><img src="/files/q3G7HXCPtA16QfkRvB61" alt=""><figcaption></figcaption></figure>

&#x20; 4\.  In the **Availability Type** list, select one of the following:

* **No Infrastructure Redundancy Required** – Select to not replicate data at a redundant location in another zone or set.
* **Availability Zone** – Select a zone in the Availability Zone list.
* **Availability Set** – Select a set in the Availability Set list.

&#x20; 5\.  In the **Private IP Address** box, assign an available IP address, or switch the **Custom** toggle key to **Auto assigned**.

&#x20; 6\.  In the **Disks** tab, enter a new Name for each disk. <mark style="color:$danger;">Similar names will cause the recovery to fail.</mark>

&#x20; 7\.  Select **Recover Virtual Machine**.

&#x20; 8\.  To view the recovery progress, select **Recovery Monitor**. Use the Cloud buttons to display the Azure  (<img src="/files/vaO9xVzGmSXRQi94af88" alt="" data-size="line">) recoveries.

### 7.5.2 Recovering Only Disks of a VM

**To recover only disks attached to the VM:**

1. Select **Recover Disks Only**.&#x20;

<figure><img src="/files/bUpUwriWPYXwCn1LiC4E" alt=""><figcaption></figcaption></figure>

&#x20; 2\.  In the **Disks** tab, enter a new **Name** for each disk. <mark style="color:$danger;">Similar names will cause the recovery to fail.</mark>

&#x20; 3\. See Note above about changing the Encryption Set for certain disks.&#x20;

&#x20; 4\.  Change other settings as needed, and select **Recover Disk**.

&#x20; 5\.  To view the recovery progress, select **Recovery Monitor**. Use the Cloud buttons to display the Azure  (<img src="/files/vaO9xVzGmSXRQi94af88" alt="" data-size="line">) recoveries.

### 7.5.3 Recovering Independent Disks

**To recover from backups with independent disks:**

1. Select the backup, and then select  <img src="/files/2Q0tCXUi2xHBpyvM2N8M" alt="" data-size="original"> **Recover** as in step 1 of the VM recovery.

<figure><img src="/files/rFgxGbArVXwAiwnzICeX" alt=""><figcaption></figcaption></figure>

&#x20; 2\.  In the **Independent Disks** tab, enter a new **Name** for each disk to recover. <mark style="color:$danger;">Similar names will cause failure</mark>.&#x20;

&#x20; 3\.  See Note above about changing the Encryption Set for certain disks.

&#x20; 4\.  Change other settings as needed, and select **Recover Disk**.

&#x20; 5\.  To view the recovery progress, select **Recovery Monitor**. Use the Cloud buttons to display the Azure  (<img src="/files/94shYaESqm26z0nqwdUO" alt="" data-size="line">) recoveries.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.n2ws.com/quick-start/7-backing-up-and-recovering-azure-vms-and-disks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
