How can I script the creation of an Enhanced Azure Recovery Services backup policy for Virtual Machines?

Nathan Given 26 Reputation points
2024-10-31T18:33:14.73+00:00

I have over 70 backup recovery services vaults and I'm trying to mass create a new Enhanced Azure Virtual Machine Backup policy[1]. Doing this through Azure Portal works great, but is quite tedious.

We've looked into using powershell to script this out, but unfortunately New-AzRecoveryServicesBackupProtectionPolicy doesn't have a PolicyType parameter and everything I've tried seems to always create standard policies.

I'd like to use powershell for this mass creation of enhanced policies, however, if there is a way to do it in another, scripted manner, that'd be great to know.

Thank you,

Nathan

[1] This is the policy creation screen in Azure Portal that let's us create an enhanced policy.

https://i.imgur.com/twNGrhS.png

Azure Backup
Azure Backup
An Azure backup service that provides built-in management at scale.
1,286 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Ryan Hill 28,716 Reputation points Microsoft Employee
    2024-10-31T21:09:45.69+00:00

    @Nathan Given per your screen shot, the policies have to be created separately and passed as -RetentionPolicy and -SchedulePolicy parameters. See Back up Azure VMs with Enhanced policy - Azure Backup | Microsoft Learn for details. Did you follow these steps and ran into an issue?

    1 person found this answer helpful.

  2. hossein jalilian 8,155 Reputation points
    2024-10-31T19:45:46.3433333+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    You can use the New-AzRecoveryServicesBackupProtectionPolicy cmdlet with specific parameters to define an Enhanced policy.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.