Disable-AzRecoveryServicesBackupProtection

Disables protection for a Backup-protected item.

Syntax

Disable-AzRecoveryServicesBackupProtection
       [-Item] <ItemBase>
       [-RemoveRecoveryPoints]
       [-RetainRecoveryPointsAsPerPolicy]
       [-Force]
       [-VaultId <String>]
       [-DefaultProfile <IAzureContextContainer>]
       [-Token <String>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]

Description

The Disable-AzRecoveryServicesBackupProtection cmdlet disables protection for an Azure Backup-protected item. This cmdlet stops regular scheduled backup of an item and retain forever. This cmdlet can also delete existing recovery points for the backup item if executed with RemoveRecoveryPoints parameter. This cmdlet can suspend backup of an item and retain recovery points as per backup policy if used with RetainRecoveryPointsAsPerPolicy parameter. One condition with this scenario is that backups can't be suspended until immutability is enabled on the vault. To enable immutability on a recovery services vault, pls follow Update-AzRecoveryServicesVault cmdlet. Set the vault context by using the Set-AzRecoveryServicesVaultContext cmdlet before you use the current cmdlet.

Examples

Example 1: Disable Backup protection

$Cont = Get-AzRecoveryServicesBackupContainer -ContainerType AzureVM
$PI = Get-AzRecoveryServicesBackupItem -Container $Cont[0] -WorkloadType AzureVM
Disable-AzRecoveryServicesBackupProtection -Item $PI[0]

The first command gets an array of backup containers, and then stores it in the $Cont array. The second command gets the Backup item corresponding to the first container item, and then stores it in the $PI variable. The last command disables Backup protection for the item in $PI[0], but retains the data.

Example 2

Disables protection for a Backup-protected item. (autogenerated)

Disable-AzRecoveryServicesBackupProtection -Item $PI[0] -RemoveRecoveryPoints -VaultId $vault.ID

Example 3: Disable protection with retain recovery points as per policy

$item = Get-AzRecoveryServicesBackupItem -VaultId $suspendVault.ID -BackupManagementType AzureVM -WorkloadType AzureVM
Disable-AzRecoveryServicesBackupProtection -Item $item[0] -RetainRecoveryPointsAsPerPolicy -VaultId $vault.ID -Force
$item = Get-AzRecoveryServicesBackupItem -VaultId $suspendVault.ID -BackupManagementType AzureVM -WorkloadType AzureVM
 $item[0].ProtectionState

BackupsSuspended

The first cmdlet fetches the AzureVM backup items for the recovery services vault. The second cmdlet is used to suspend backup for $item[0] of the recovery services vault. One condition with this scenario is that backups can't be suspended until immutability is enabled on the vault. To enable immutability on a recovery services vault, pls follow Update-AzRecoveryServicesVault cmdlet. The third and fourth command are used to fetch the updated backup item and its protection state. To resume protection back, please use Enable-AzRecoveryServicesBackupProtection with parameter -Item.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Item

Specifies the Backup item for which this cmdlet disables protection. To obtain an AzureRmRecoveryServicesBackupItem, use the Get-AzRecoveryServicesBackupItem cmdlet.

Type:ItemBase
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-RemoveRecoveryPoints

Indicates that this cmdlet deletes existing recovery points.

Type:SwitchParameter
Position:2
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RetainRecoveryPointsAsPerPolicy

If this option is used, all the recovery points for this item will expire as per the retention policy.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Token

Auxiliary access token for authenticating critical operation to resource guard subscription

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VaultId

ARM ID of the Recovery Services Vault.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

ItemBase

String

Outputs

JobBase