Skip to content

Commit 5ad15c7

Browse files
authored
Merge pull request #301052 from AbhishekMallick01/Jun-9-2025-Freshness
Freshness - Audit and enforce VM backup using Az Policy
2 parents 38ed855 + 6331fd6 commit 5ad15c7

File tree

2 files changed

+70
-42
lines changed

2 files changed

+70
-42
lines changed
Lines changed: 67 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,100 @@
11
---
2-
title: Auto-Enable Backup on VM Creation using Azure Policy
3-
description: 'An article describing how to use Azure Policy to auto-enable backup for all VMs created in a given scope'
2+
title: Audit and enforce backup during VM creation automatically using Azure Policy
3+
description: Learn how to use Azure Policy to autoenable backup for all VMs created in a given scope.
44
ms.topic: how-to
5-
ms.date: 06/29/2024
5+
ms.date: 06/09/2025
66
ms.service: azure-backup
77
author: jyothisuri
88
ms.author: jsuri
99
ms.custom: engagement-fy24
1010
---
1111

12-
# Auto-enable backup on VM creation using Azure Policy
12+
# Audit and enforce backup during virtual machine creation automatically using Azure Policy
1313

14-
One of the key responsibilities of a Backup or Compliance Admin in an organization is to ensure that all business-critical machines are backed up with the appropriate retention.
14+
This article describes how Backup or Compliance Admins can ensure that all business-critical machines have appropriate backup and retention policies.
1515

16-
Today, Azure Backup provides a variety of built-in policies (using [Azure Policy](../governance/policy/overview.md)) to help you automatically ensure that your Azure virtual machines are configured for backup. Depending on how your backup teams and resources are organized, you can use any one of the below policies:
16+
Azure Backup offers a variety of built-in policies through [Azure Policy](../governance/policy/overview.md) to help you automatically configure backup for your Azure Virtual Machines (VMs). Based on the structure of your backup teams and the organization of your resources, you can choose the most suitable policy from the following options to ensure effective and consistent backup management.
1717

18-
## Policy 1 - Configure backup on VMs without a given tag to an existing recovery services vault in the same location
18+
## Azure Policy types for Azure VM backup
1919

20-
If your organization has a central backup team that manages backups across application teams, you can use this policy to configure backup to an existing central Recovery Services vault in the same subscription and location as the VMs being governed. You can choose to **exclude** VMs which contain a certain tag, from the scope of this policy.
20+
The following table lists the various policy types that allows you to manage Azure VM instances backups automatically:
2121

22-
## Policy 2 - Configure backup on VMs with a given tag to an existing recovery services vault in the same location
23-
This policy works the same as Policy 1 above, with the only difference being that you can use this policy to **include** VMs which contain a certain tag, in the scope of this policy.
22+
| Policy type | Description |
23+
| --- | --- |
24+
| Policy 1 | Configures backup on VMs without a given tag to an existing Recovery Services vault in the same location. |
25+
| Policy 2 | Configures backup on VMs with a given tag to an existing Recovery Services vault in the same location. |
26+
| Policy 3 | Configures backup on VMs without a given tag to a new Recovery Services vault with a default policy. |
27+
| Policy 4 | Configures backup on VMs with a given tag to a new Recovery Services vault with a default policy. |
2428

25-
## Policy 3 - Configure backup on VMs without a given tag to a new recovery services vault with a default policy
26-
If you organize applications in dedicated resource groups and want to have them backed up by the same vault, this policy allows you to automatically manage this action. You can choose to **exclude** VMs which contain a certain tag, from the scope of this policy.
29+
### Policy 1: Configure backup on VMs without a given tag to an existing recovery services vault in the same location
2730

28-
## Policy 4 - Configure backup on VMs with a given tag to a new recovery services vault with a default policy
29-
This policy works the same as Policy 3 above, with the only difference being that you can use this policy to **include** VMs which contain a certain tag, in the scope of this policy.
31+
This policy enables a central backup team to configure backup for Azure Virtual Machines using an existing central Recovery Services vault located in the same subscription and region as the governed VMs. You can **exclude** specific VMs from the policy scope with a designated tag.
3032

31-
In addition to the above, Azure Backup also provides an [audit-only](../governance/policy/concepts/effects.md#audit) policy - **Azure Backup should be enabled for Virtual Machines**. This policy identifies which virtual machines do not have backup enabled, but doesn't automatically configure backups for these VMs. This is useful when you are only looking to evaluate the overall compliance of the VMs but not looking to take action immediately.
3233

33-
## Supported Scenarios
34+
### Policy 2: Configure backup on VMs with a given tag to an existing recovery services vault in the same location
35+
This policy functions same as Policy 1, with a key difference - the policy **includes** virtual machines in the policy scope if they have a specific tag.
3436

35-
* The built-in policy is currently supported only for Azure VMs. Users must take care to ensure that the retention policy specified during assignment is a VM retention policy. Refer to [this](./backup-azure-policy-supported-skus.md) document to see all the VM SKUs supported by this policy.
37+
### Policy 3: Configure backup on VMs without a given tag to a new recovery services vault with a default policy
3638

37-
* Policies 1 and 2 can be assigned to a single location and subscription at a time. To enable backup for VMs across locations and subscriptions, multiple instances of the policy assignment need to be created, one for each combination of location and subscription.
39+
This policy targets applications organized in dedicated resource groups and backs them up using the same Recovery Services vault. It automatically manages this configuration and allows you to **exclude** virtual machines from the policy scope that have a specific tag.
3840

39-
* For Policies 1 and 2, management group scope is currently unsupported.
41+
### Policy 4: Configure backup on VMs with a given tag to a new recovery services vault with a default policy
4042

41-
* For Policies 1 and 2, the specified vault and the VMs configured for backup can be under different resource groups.
43+
This policy functions same as Policy 3, with a key difference - the policy **includes** virtual machines in the policy scope if they have a specific tag.
4244

43-
* Policies 3 and 4 can be assigned to a single subscription at a time (or a resource group within a subscription).
45+
Azure Backup also provides an [audit-only](../governance/policy/concepts/effects.md#audit) policy - **Azure Backup should be enabled for Virtual Machines**. This policy identifies virtual machines without backup enabled but doesn't apply any backup configuration, which helps assess compliance without enforcing changes.
46+
47+
## Supported and unsupported Scenarios for Azure VMs backup with Azure Policy
48+
49+
The following table lists the supported and unsupported scenarios for the available policy types:
50+
51+
| Policy type | Supported | Unsupported |
52+
| --- | --- | --- |
53+
| **Built-in policy** | Currently supported only for Azure VMs. Ensure that the retention policy specified during assignment is a VM retention policy. <br><br> Learn about [the VM SKUs supported by this policy](./backup-azure-policy-supported-skus.md) . | |
54+
| **Policies 1 and 2** | - Can be assigned to a single location and subscription at a time. To enable backup for VMs across locations and subscriptions, you need to create multiple instances of the policy assignment, one for each combination of location and subscription. <br><br> - The specified vault and the VMs configured for backup can be under different resource groups. | Management group scope is currently unsupported. |
55+
| **Policies 3 and 4** | Can be assigned to a single subscription at a time (or a resource group within a subscription). | |
4456

4557
[!INCLUDE [backup-center.md](../../includes/backup-center.md)]
4658

47-
## Using the built-in policies
59+
## Assign built-in Azure Policy for Azure VM backup
60+
61+
This section outlines the end-to-end steps to assign [Policy 1](#policy-1-configure-backup-on-vms-without-a-given-tag-to-an-existing-recovery-services-vault-in-the-same-location). The same instructions apply to the other policies. After assignment, the policy automatically configures backup for any new VM created within the defined scope.
62+
63+
To assign Policy 1 for Azure VM backup, follow these steps:
64+
65+
1. In the [Azure portal](https://portal.azure.com/), go to **Policy**> **Authoring** > **Definitions** to view the list of all built-in policies across Azure Resources.
66+
67+
1. On the **Policy Definitions** pane, filter the list for **Category=Backup** and select the policy named *Configure backup on virtual machines without a given tag to an existing recovery services vault in the same location*.
68+
69+
:::image type="content" source="./media/backup-azure-auto-enable-backup/policy-dashboard-inline.png" alt-text="Screenshot showing how to filter the list by category on Policy dashboard." lightbox="./media/backup-azure-auto-enable-backup/policy-dashboard-expanded.png":::
70+
71+
1. On the selected policy pane, review the policy details, and then select **Assign**.
72+
73+
:::image type="content" source="./media/backup-azure-auto-enable-backup/policy-definition-blade.png" alt-text="Screenshot shows the Policy Definition pane." lightbox="./media/backup-azure-auto-enable-backup/policy-definition-blade.png":::
74+
75+
1. On the **Assign Policy** pane, on the **Basics** tab, select the **more icon** corresponding to **Scope**.
76+
77+
:::image type="content" source="./media/backup-azure-auto-enable-backup/policy-assignment-basics.png" alt-text="Screenshot shows the Policy Assignment Basics tab." lightbox="./media/backup-azure-auto-enable-backup/policy-assignment-basics.png":::
78+
79+
1. On the right context pane, select the subscription for the policy to be applied on.
80+
81+
You can also select a resource group, so that the policy is applied only for VMs in a particular resource group.
82+
83+
1. On the **Parameters** tab, select the **Location**, **Vault**, and **Backup Policy** to which the VMs in the scope must be associated.
84+
85+
You can also specify a tag name and an array of tag values. A VM which contains any of the specified values for the given tag are excluded from the scope of the policy assignment.
86+
87+
:::image type="content" source="./media/backup-azure-auto-enable-backup/policy-assignment-parameters.png" alt-text="Screenshot shows the Policy Assignment Parameters pane." lightbox="./media/backup-azure-auto-enable-backup/policy-assignment-parameters.png":::
4888

49-
The below steps describe the end-to-end process of assigning Policy 1: **Configure backup on VMs without a given tag to an existing recovery services vault in the same location** to a given scope. Similar instructions will apply for the other policies. Once assigned, any new VM created in the scope is automatically configured for backup.
89+
Ensure that **Effect** is set to **`deployIfNotExists`**.
5090

51-
1. Sign in to the Azure portal and navigate to the **Policy** Dashboard.
52-
2. Select **Definitions** in the left menu to get a list of all built-in policies across Azure Resources.
53-
3. Filter the list for **Category=Backup** and select the policy named *Configure backup on virtual machines without a given tag to an existing recovery services vault in the same location*.
54-
:::image type="content" source="./media/backup-azure-auto-enable-backup/policy-dashboard-inline.png" alt-text="Screenshot showing how to filter the list by category on Policy dashboard." lightbox="./media/backup-azure-auto-enable-backup/policy-dashboard-expanded.png":::
55-
4. Select the name of the policy. You'll be redirected to the detailed definition for this policy.
56-
![Screenshot showing the Policy Definition pane.](./media/backup-azure-auto-enable-backup/policy-definition-blade.png)
57-
5. Select the **Assign** button at the top of the pane. This redirects you to the **Assign Policy** pane.
58-
6. Under **Basics**, select the three dots next to the **Scope** field. This opens up a right context pane where you can select the subscription for the policy to be applied on. You can also optionally select a resource group, so that the policy is applied only for VMs in a particular resource group.
59-
![Screenshot showing the Policy Assignment Basics tab.](./media/backup-azure-auto-enable-backup/policy-assignment-basics.png)
60-
7. In the **Parameters** tab, choose a location from the drop-down, and select the vault and backup policy to which the VMs in the scope must be associated. You can also choose to specify a tag name and an array of tag values. A VM which contains any of the specified values for the given tag will be excluded from the scope of the policy assignment.
61-
![Screenshot showing the Policy Assignment Parameters pane.](./media/backup-azure-auto-enable-backup/policy-assignment-parameters.png)
62-
8. Ensure that **Effect** is set to deployIfNotExists.
63-
9. Navigate to **Review+create** and select **Create**.
91+
1. On the **Review+create** tab, select **Create**.
6492

6593
> [!NOTE]
6694
>
6795
> - Azure Policy can also be used on existing VMs, using [remediation](../governance/policy/how-to/remediate-resources.md).
68-
> - It's recommended that this policy not be assigned to more than 200 VMs at a time. If the policy is assigned to more than 200 VMs, it can result in the backup being triggered a few hours later than that specified by the schedule.
96+
> - Avoid assigning this policy to more than 200 VM at once, as it might delay backup triggers by several hours beyond the scheduled time.
6997
70-
## Next step
98+
## Related content
7199

72-
[Learn more about Azure Policy](../governance/policy/overview.md)
100+
[About Azure Policy](../governance/policy/overview.md).

articles/backup/guidance-best-practices.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Guidance and best practices
33
description: Discover the best practices and guidance for backing up cloud and on-premises workload to the cloud
44
ms.topic: overview
5-
ms.date: 12/30/2024
5+
ms.date: 06/09/2025
66
ms.reviewer: dapatil
77
ms.service: azure-backup
88
author: jyothisuri
@@ -292,9 +292,9 @@ Governance in Azure is primarily implemented with [Azure Policy](../governance/p
292292

293293
- Whenever new infrastructure is provisioned and new VMs are created, as a backup admin, you need to ensure their protection. You can easily configure backups for one or two VMs. But it becomes complex when you need to configure hundreds or even thousands of VMs at scale. To simplify the process of configuring backups, Azure Backup provides you with a set of built-in Azure Policies to govern your backup estate.
294294

295-
- **Auto-enable backup on VMs using Policy (Central backup team model)**: If your organization has a central backup team that manages backups across application teams, you can use this policy to configure backup to an existing central Recovery Services vault in the same subscription and location as that of the VMs. You can choose to include/exclude VMs that contain a certain tag from the policy scope. [Learn more](backup-azure-auto-enable-backup.md#policy-1---configure-backup-on-vms-without-a-given-tag-to-an-existing-recovery-services-vault-in-the-same-location).
295+
- **Auto-enable backup on VMs using Policy (Central backup team model)**: If your organization has a central backup team that manages backups across application teams, you can use this policy to configure backup to an existing central Recovery Services vault in the same subscription and location as that of the VMs. You can choose to include/exclude VMs that contain a certain tag from the policy scope. [Learn more](backup-azure-auto-enable-backup.md#policy-1-configure-backup-on-vms-without-a-given-tag-to-an-existing-recovery-services-vault-in-the-same-location).
296296

297-
- **Auto-enable backup on VMs using Policy (where backup owned by application teams)**: If you organize applications in dedicated resource groups and want to have them backed-up by the same vault, use this policy to automatically manage this action. You can choose to include/exclude VMs that contain a certain tag from the policy scope. [Learn more](backup-azure-auto-enable-backup.md#policy-3---configure-backup-on-vms-without-a-given-tag-to-a-new-recovery-services-vault-with-a-default-policy).
297+
- **Auto-enable backup on VMs using Policy (where backup owned by application teams)**: If you organize applications in dedicated resource groups and want to have them backed-up by the same vault, use this policy to automatically manage this action. You can choose to include/exclude VMs that contain a certain tag from the policy scope. [Learn more](backup-azure-auto-enable-backup.md#policy-3-configure-backup-on-vms-without-a-given-tag-to-a-new-recovery-services-vault-with-a-default-policy).
298298

299299
- **Monitoring Policy**: To generate the Backup Reports for your resources, enable the diagnostic settings when you create a new vault. Often, adding a diagnostic setting manually per vault can be a cumbersome task. So, you can utilize an Azure built-in policy that configures the diagnostics settings at scale to all vaults in each subscription or resource group, with Log Analytics as the destination.
300300

0 commit comments

Comments
 (0)