Enable-AzRecoveryServicesBackupProtection

Enables backup for an item with a specified Backup protection policy.

Syntax

Enable-AzRecoveryServicesBackupProtection
      [-Policy] <PolicyBase>
      [-Name] <String>
      [-ResourceGroupName] <String>
      [-VaultId <String>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Enable-AzRecoveryServicesBackupProtection
      [-Policy] <PolicyBase>
      [-Name] <String>
      [-ServiceName] <String>
      [-VaultId <String>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Enable-AzRecoveryServicesBackupProtection
      [-Policy] <PolicyBase>
      [-Name] <String>
      [-StorageAccountName] <String>
      [-VaultId <String>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Enable-AzRecoveryServicesBackupProtection
      [-Policy] <PolicyBase>
      [-ProtectableItem] <ProtectableItemBase>
      [-VaultId <String>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Enable-AzRecoveryServicesBackupProtection
      [-Policy] <PolicyBase>
      [-Item] <ItemBase>
      [-VaultId <String>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Enable-AzRecoveryServicesBackupProtection cmdlet sets Azure Backup protection policy on an item. 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

PS C:\> $Pol = Get-AzRecoveryServicesBackupProtectionPolicy -Name "DefaultPolicy"
PS C:\> Enable-AzRecoveryServicesBackupProtection -Policy $Pol -Name "V2VM" -ResourceGroupName "RGName1"
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 sets the Backup protection policy for the ARM virtual machine named V2VM using the policy in $Pol.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

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

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Item

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

Type:Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ItemBase
Position:4
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-Name

Specifies the name of the Backup item.

Type:String
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Policy

Specifies protection policy that this cmdlet associates with an item. To obtain an AzureRmRecoveryServicesBackupProtectionPolicy object, use the Get-AzRecoveryServicesBackupProtectionPolicy cmdlet.

Type:Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.PolicyBase
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ProtectableItem

Filter value for status of job.

Type:Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ProtectableItemBase
Position:2
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of the resource group. Specify this parameter only for ARM virtual machines.

Type:String
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServiceName

Specifies the service name. Specify this parameter only for ASM virtual machines.

Type:String
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-StorageAccountName

Azure file share storage account name

Type:String
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-VaultId

ARM ID of the Recovery Services Vault.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
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:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ItemBase

Outputs

Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.JobBase