none
Powershell equivalent of az backup item set-policy RRS feed

  • Question

  • Hi, I am looking for the powershell equivalent of a backup policy modification of a vm already having a policy. az version is "az backup item set-policy" how to achieve this in powershell?

    ZeKroustibat

    Thursday, October 10, 2019 10:05 AM

Answers

  • Ok, found the solution

    You need to :

    Disable-AzRecoveryServicesBackupProtection

    Then

    Enable-AzRecoveryServicesBackupProtection

    But, when Enable, you need to use "-item" parameter and not "-name" parameter.

    • Marked as answer by ZeKroustibat Thursday, October 10, 2019 2:01 PM
    Thursday, October 10, 2019 2:00 PM

All replies

  • Hi ZeKroustibat,

    AFAIK Set-AzRecoveryServicesBackupProtectionPolicy is the Az PowerShell cmdlet used to modify a Backup protection policy.

    To know all the Az PowerShell cmdlets that are related to Azure Recovery Services, refer this document.

    Hope this helps!
    Thursday, October 10, 2019 10:52 AM
    Moderator
  • Thank you for your answer, but this cmdlet allows to modify a policy but not the binding of a VM with an existing policy. Enable-AzRecoveryServicesBackupProtection creates the link, but does not allow the backup policy to be changed after, az cli yes. This is just a modification in portal, but howto in powershell ?
    Thursday, October 10, 2019 11:30 AM
  • Ok, found the solution

    You need to :

    Disable-AzRecoveryServicesBackupProtection

    Then

    Enable-AzRecoveryServicesBackupProtection

    But, when Enable, you need to use "-item" parameter and not "-name" parameter.

    • Marked as answer by ZeKroustibat Thursday, October 10, 2019 2:01 PM
    Thursday, October 10, 2019 2:00 PM