Enable-AzRecoveryServicesBackupProtection
Enables or resumes backup for an item with a specified Backup protection policy.
Syntax
AzureVMComputeEnableProtection (Default)
Enable-AzRecoveryServicesBackupProtection
[-Policy] <PolicyBase>
[-Name] <String>
[-ResourceGroupName] <String>
[-InclusionDisksList <String[]>]
[-ExclusionDisksList <String[]>]
[-ExcludeAllDataDisks]
[-VaultId <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
AzureVMClassicComputeEnableProtection
Enable-AzRecoveryServicesBackupProtection
[-Policy] <PolicyBase>
[-Name] <String>
[-ServiceName] <String>
[-InclusionDisksList <String[]>]
[-ExclusionDisksList <String[]>]
[-ExcludeAllDataDisks]
[-VaultId <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
AzureFileShareEnableProtection
Enable-AzRecoveryServicesBackupProtection
[-Policy] <PolicyBase>
[-Name] <String>
[-StorageAccountName] <String>
[-VaultId <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
AzureWorkloadEnableProtection
Enable-AzRecoveryServicesBackupProtection
[-Policy] <PolicyBase>
[-ProtectableItem] <ProtectableItemBase>
[-VaultId <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ModifyProtection
Enable-AzRecoveryServicesBackupProtection
[-Policy] <PolicyBase>
[-Item] <ItemBase>
[-InclusionDisksList <String[]>]
[-ExclusionDisksList <String[]>]
[-ResetExclusionSettings]
[-ExcludeAllDataDisks]
[-VaultId <String>]
[-DefaultProfile <IAzureContextContainer>]
[-Token <String>]
[-SecureToken <SecureString>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Enable-AzRecoveryServicesBackupProtection cmdlet enables the backup by associating a protection policy with the item. If policy ID is not present or the backup item is not associated with any policy, then this command will expect a policyID. You can also use the same command to resume backup for a resource for which you've stopped protection with the data retention option. Set the vault context by using the Set-AzRecoveryServicesVaultContext cmdlet before you use the current cmdlet.
Examples
Example 1: Enable Backup protection for an item
$Pol = Get-AzRecoveryServicesBackupProtectionPolicy -Name "DefaultPolicy"
$inclusionDiskLUNS = ("1", "2")
Enable-AzRecoveryServicesBackupProtection -Policy $Pol -Name "V2VM" -ResourceGroupName "RGName1" -InclusionDisksList $inclusionDiskLUNS
WorkloadName Operation Status StartTime EndTime
------------ --------- ------ --------- -------
co03-vm ConfigureBackup Completed 11-Apr-16 12:19:49 PM 11-Apr-16 12:19:54 PM
The first cmdlet gets a default policy object, and then stores it in the $Pol variable.
The second cmdlet specifies the disk LUNs which are to be backed up and stores it in $inclusionDiskLUNS variable.
The third cmdlet sets the Backup protection policy for the ARM virtual machine named V2VM, in a resource group named RGName1, using the policy in $Pol.
Example 2
Enables backup for an item with a specified Backup protection policy or resumes backup for an item that has data retained when backup was stopped.
Enable-AzRecoveryServicesBackupProtection -Item $Item -Policy $Pol -VaultId $vault
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ExcludeAllDataDisks
Option to specify to backup OS disks only
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
AzureVMComputeEnableProtection
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
AzureVMClassicComputeEnableProtection
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ModifyProtection
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ExclusionDisksList
List of Disk LUNs to be excluded in backup and the rest are automatically included.
Parameter properties
Type: String [ ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
AzureVMComputeEnableProtection
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
AzureVMClassicComputeEnableProtection
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ModifyProtection
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-InclusionDisksList
List of Disk LUNs to be included in backup and the rest are automatically excluded except OS disk.
Parameter properties
Type: String [ ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
AzureVMComputeEnableProtection
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
AzureVMClassicComputeEnableProtection
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ModifyProtection
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Item
Specifies the Backup item for which this cmdlet enables protection.
To obtain an AzureRmRecoveryServicesBackupItem , use the Get-AzRecoveryServicesBackupItem cmdlet.
Parameter properties
Type: ItemBase
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ModifyProtection
Position: 4
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-Name
Specifies the name of the Backup item.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
AzureVMComputeEnableProtection
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
AzureVMClassicComputeEnableProtection
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
AzureFileShareEnableProtection
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Policy
Specifies protection policy that this cmdlet associates with an item.
To obtain an AzureRmRecoveryServicesBackupProtectionPolicy object, use the Get-AzRecoveryServicesBackupProtectionPolicy cmdlet.
Parameter properties
Type: PolicyBase
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ProtectableItem
Specifies the item to be protected with the given policy.
Parameter properties
Parameter sets
AzureWorkloadEnableProtection
Position: 2
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-ResetExclusionSettings
Specifies to reset disk exclusion setting associated with the item
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ModifyProtection
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
Specifies the name of the resource group of a virtual machine.
Specify this parameter only for ARM virtual machines.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
AzureVMComputeEnableProtection
Position: 3
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-SecureToken
Parameter to authorize operations protected by cross tenant resource guard. Use command (Get-AzAccessToken -TenantId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").Token to fetch authorization token for different tenant
Parameter properties
Type: SecureString
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ModifyProtection
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ServiceName
Cloud Service Name for Azure Classic Compute VM.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
AzureVMClassicComputeEnableProtection
Position: 3
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-StorageAccountName
Azure file share storage account name
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
AzureFileShareEnableProtection
Position: 3
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Token
Auxiliary access token for authenticating critical operation to resource guard subscription
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ModifyProtection
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-VaultId
ARM ID of the Recovery Services Vault.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs