Edit

Get-AzRecoveryServicesBackupRecoveryLogChain

This command lists the start and end points of the unbroken log chain of the given backup item. Use it to determine whether the point-in-time, to which the user wants the DB to be restored, is valid or not.

Syntax

NoFilterParameterSet (Default)

Get-AzRecoveryServicesBackupRecoveryLogChain
    [-Item] <ItemBase>
    [-UseSecondaryRegion]
    [-BaseSnapshotRecoveryPointId <String>]
    [-BaseRecoveryPointDatasourceId <String>]
    [-RecoveryMode <String>]
    [-VaultId <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

DateTimeFilter

Get-AzRecoveryServicesBackupRecoveryLogChain
    [[-StartDate] <DateTime>]
    [[-EndDate] <DateTime>]
    [-Item] <ItemBase>
    [-UseSecondaryRegion]
    [-BaseSnapshotRecoveryPointId <String>]
    [-BaseRecoveryPointDatasourceId <String>]
    [-RecoveryMode <String>]
    [-VaultId <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Get-AzRecoveryServicesBackupRecoveryLogChain cmdlet gets the time range recovery points in time for a backed up Azure Backup item. After an item has been backed up, an AzRecoveryServicesBackupRecoveryLogChain object has one or more recovery time ranges.

Examples

Example 1

$StartDate = (Get-Date).AddDays(-7)
$EndDate = Get-Date
$Container = Get-AzRecoveryServicesBackupContainer -ContainerType AzureWorkload
$RP = Get-AzRecoveryServicesBackupItem -Container $Container -WorkloadType MSSQL | Get-AzRecoveryServicesBackupRecoveryLogChain -StartDate $Startdate.ToUniversalTime() -EndDate $Enddate.ToUniversalTime()

The first command gets the date from seven days ago, and then stores it in the $StartDate variable. The second command gets today's date, and then stores it in the $EndDate variable. The third command gets AzureWorkload backup containers, and stores them in the $Container variable. The fourth command gets the backup item, and then shares it across the piped cmdlet as backup item object. The last command gets an array of recovery point time ranges for the item in $BackupItem, and then stores them in the $RP variable.

Example 2

This command lists the start and end points of the unbroken log chain of the given backup item. (autogenerated)

Get-AzRecoveryServicesBackupRecoveryLogChain -Item $Item -VaultId $vault.ID

Example 3: Get database log ranges for a SQL Instance snapshot

$container = Get-AzRecoveryServicesBackupContainer -ContainerType AzureVMAppContainer `
    -BackupManagementType AzureWorkload -FriendlyName "sql-vm" -VaultId $vault.ID
$instance = Get-AzRecoveryServicesBackupItem -Container $container `
    -WorkloadType MSSQLInstance -Name "SQLInstance;mssqlserver" -VaultId $vault.ID
$snapshot = Get-AzRecoveryServicesBackupRecoveryPoint -Item $instance `
    -RestorePointQueryType Snapshot -GetLatestRecoveryPointOnly -VaultId $vault.ID
$snapshot = Get-AzRecoveryServicesBackupRecoveryPoint -Item $instance `
    -RecoveryPointId $snapshot.RecoveryPointId -VaultId $vault.ID
$database = $snapshot.IncludedDatabases[0]
$databaseItem = Get-AzRecoveryServicesBackupItem -Container $container `
    -WorkloadType MSSQL -Name "SQLDataBase;$($database.DatasourceName)" -VaultId $vault.ID
Get-AzRecoveryServicesBackupRecoveryLogChain -Item $databaseItem `
    -BaseSnapshotRecoveryPointId $snapshot.RecoveryPointId `
    -BaseRecoveryPointDatasourceId $instance.ProtectedItemDataSourceId `
    -RecoveryMode SnapshotAttachAndRecover -VaultId $vault.ID

This example lists log time ranges for a database included in an existing SQL Instance snapshot. The item is the database item, while the base datasource ID belongs to the protected SQL Instance, not the included database. The database must have log backups available. StartDate and EndDate can also be supplied to limit the queried time range. Without snapshot-context parameters, the command continues to list the item's ordinary log ranges.

Parameters

-BaseRecoveryPointDatasourceId

Specifies the ProtectedItemDataSourceId of the SQL Instance that owns the base snapshot. For snapshot-based database log queries, supply this with BaseSnapshotRecoveryPointId and RecoveryMode. Do not use the per-database DatasourceId from IncludedDatabases.

Parameter properties

Type:String
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

-BaseSnapshotRecoveryPointId

Specifies the SQL Instance snapshot recovery point ID on which to base a database log-range query. Use an Item representing a database included in that snapshot, together with BaseRecoveryPointDatasourceId and RecoveryMode.

Parameter properties

Type:String
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

-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

-EndDate

End time of Time range for which recovery point need to be fetched

Parameter properties

Type:

Nullable<T>[DateTime]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

DateTimeFilter
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Item

Protected Item object for which recovery point need to be fetched

Parameter properties

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

Parameter sets

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

-RecoveryMode

Filters SQL log ranges by snapshot recovery mode. Accepted values are SnapshotAttachAndRecover, SnapshotAttach, and RecoveryUsingSnapshot. For log replay on top of a base snapshot, use SnapshotAttachAndRecover with BaseSnapshotRecoveryPointId and BaseRecoveryPointDatasourceId. The command returns time ranges only; it does not execute a restore.

Parameter properties

Type:String
Default value:None
Accepted values:SnapshotAttachAndRecover, SnapshotAttach, RecoveryUsingSnapshot
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

-StartDate

Start time of Time range for which recovery point need to be fetched

Parameter properties

Type:

Nullable<T>[DateTime]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

DateTimeFilter
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-UseSecondaryRegion

Retrieves log recovery ranges from the secondary region for Cross Region Restore. For log recovery on top of a SQL instance snapshot, specify -RecoveryMode, -BaseSnapshotRecoveryPointId, and -BaseRecoveryPointDatasourceId using the secondary-region snapshot and the source instance datasource ID.

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

-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

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

System.String

Outputs

RecoveryPointBase