Edit

Share via


Backup-AzRecoveryServicesBackupItem

Starts a backup for a Backup item.

Syntax

Default (Default)

Backup-AzRecoveryServicesBackupItem
    -Item <ItemBase>
    [-ExpiryDateTimeUTC <DateTime>]
    [-BackupType <BackupType>]
    [-EnableCompression]
    [-VaultId <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Backup-AzRecoveryServicesBackupItem cmdlet takes an adhoc backup of protected Azure backup item. Using this cmdlet you can do an initial backup immediately after you enable protection or start a backup if a scheduled backup fails. This cmdlet can also be used for custom retention with or without expiry date - refer parameters help text for more details.

Examples

Example 1: Start a backup for a Backup item

$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
$NamedContainer = Get-AzRecoveryServicesBackupContainer -ContainerType AzureVM -FriendlyName "pstestv2vm1" -VaultId $vault.ID
$Item = Get-AzRecoveryServicesBackupItem -Container $NamedContainer -WorkloadType AzureVM -VaultId $vault.ID
$Job = Backup-AzRecoveryServicesBackupItem -Item $Item -VaultId $vault.ID -ExpiryDateTimeUTC (Get-Date).ToUniversalTime().AddDays(60)
$Job
Operation        Status               StartTime            EndTime                   JOBID
------------     ---------            ------               ---------                 -------
pstestv2vm1      Backup               InProgress           4/23/2016 5:00:30 PM      cf4b3ef5-2fac-4c8e-a215-d2eba4124f27

The first command gets the Backup container of type AzureVM named pstestv2vm1, and then stores it in the $NamedContainer variable. The second command gets the Backup item corresponding to the container in $NamedContainer, and then stores it in the $Item variable. The last command triggers the backup job for the Backup item in $Item with an expiry time of 60 days from now, default value for expiry time is 30 days if not specified.

Example 2

Starts a backup for a Backup item. (autogenerated)

Backup-AzRecoveryServicesBackupItem -ExpiryDateTimeUTC <DateTime> -Item $Item -VaultId $vault.ID

Parameters

-BackupType

Type of backup to be performed

Parameter properties

Type:BackupType
Default value:None
Accepted values:Full, Differential, Log, CopyOnlyFull
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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

-EnableCompression

If enabling compression is required

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ExpiryDateTimeUTC

Specifies an expiry time for the Recovery point as a DateTime object, if nothing is given it takes the default value of 30 days. Applicable to VM, SQL (for only Copy-only-full backup type), AFS backup items.

Parameter properties

Type:

Nullable<T>[DateTime]

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

-Item

Specifies a Backup item for which this cmdlet starts a backup operation.

Parameter properties

Type:ItemBase
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
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.

Inputs

ItemBase

Nullable<T>

String

Outputs

JobBase