Edit

Share via


Get-AzRecoveryServicesBackupItem

Gets the items from a container in Backup.

Syntax

GetItemsForContainer (Default)

Get-AzRecoveryServicesBackupItem
    [-Container] <ContainerBase>
    [[-Name] <String>]
    [[-ProtectionStatus] <ItemProtectionStatus>]
    [[-ProtectionState] <ItemProtectionState>]
    [-WorkloadType] <WorkloadType>
    [[-DeleteState] <ItemDeleteState>]
    [-FriendlyName <String>]
    [-VaultId <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-UseSecondaryRegion]
    [<CommonParameters>]

GetItemsForVault

Get-AzRecoveryServicesBackupItem
    [-BackupManagementType] <BackupManagementType>
    [[-Name] <String>]
    [[-ProtectionStatus] <ItemProtectionStatus>]
    [[-ProtectionState] <ItemProtectionState>]
    [-WorkloadType] <WorkloadType>
    [[-DeleteState] <ItemDeleteState>]
    [-FriendlyName <String>]
    [-VaultId <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-UseSecondaryRegion]
    [<CommonParameters>]

GetItemsForPolicy

Get-AzRecoveryServicesBackupItem
    [-Policy] <PolicyBase>
    [[-Name] <String>]
    [[-ProtectionStatus] <ItemProtectionStatus>]
    [[-ProtectionState] <ItemProtectionState>]
    [[-DeleteState] <ItemDeleteState>]
    [-FriendlyName <String>]
    [-VaultId <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-UseSecondaryRegion]
    [<CommonParameters>]

Description

The Get-AzRecoveryServicesBackupItem cmdlet gets the list of protected items in a container and the protection status of the items. A container that is registered to an Azure Recovery Services vault can have one or more items that can be protected. For Azure virtual machines, there can be only one backup item in the virtual machine container. Set the vault context by using the -VaultId parameter.

Examples

Example 1: Get an item from a Backup container

$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
$Container = Get-AzRecoveryServicesBackupContainer -ContainerType AzureVM -FriendlyName "V2VM" -VaultId $vault.ID
$BackupItem = Get-AzRecoveryServicesBackupItem -Container $Container -WorkloadType AzureVM -VaultId $vault.ID

The first command gets the container of type AzureVM, and then stores it in the $Container variable. The second command gets the Backup item named V2VM in $Container, and then stores it in the $BackupItem variable.

Example 2: Get an Azure File Share Item from FriendlyName

$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
$Container = Get-AzRecoveryServicesBackupContainer -ContainerType AzureStorage -FriendlyName "StorageAccount1" -VaultId $vault.ID
$BackupItem = Get-AzRecoveryServicesBackupItem -Container $Container -WorkloadType AzureFiles -VaultId $vault.ID -FriendlyName "FileShareName"

The first command gets the container of type AzureStorage, and then stores it in the $Container variable. The second command gets the Backup item whose friendlyName matches the value passed in FriendlyName Parameter, and then stores it in the $BackupItem variable. Using FriendlyName parameter can result in returning more than one Azure File Share. In such cases, execute the cmdlet by passing value for -Name parameter as the Name property returned in the result set of $BackupItem.

Parameters

-BackupManagementType

The class of resources being protected. The acceptable values for this parameter are:

  • AzureVM
  • MAB
  • AzureStorage
  • AzureWorkload

Parameter properties

Type:BackupManagementType
Default value:None
Accepted values:AzureVM, MAB, AzureStorage, AzureWorkload
Supports wildcards:False
DontShow:False

Parameter sets

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

-Container

Specifies a container object from which this cmdlet gets backup items. To obtain an AzureRmRecoveryServicesBackupContainer, use the Get-AzRecoveryServicesBackupContainer cmdlet.

Parameter properties

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

Parameter sets

GetItemsForContainer
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
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

-DeleteState

Specifies the deletestate of the item The acceptable values for this parameter are:

  • ToBeDeleted
  • NotDeleted

Parameter properties

Type:ItemDeleteState
Default value:None
Accepted values:ToBeDeleted, NotDeleted
Supports wildcards:False
DontShow:False

Parameter sets

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

-FriendlyName

FriendlyName of the backed up item

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

-Name

Specifies the name of backup item. For file share, specify the unique ID of protected file share.

Parameter properties

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

Parameter sets

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

-Policy

Protection policy object.

Parameter properties

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

Parameter sets

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

-ProtectionState

Specifies the state of protection. The acceptable values for this parameter are:

  • IRPending. Initial synchronization has not started and there is no recovery point yet.
  • Protected. Protection is ongoing.
  • ProtectionError. There is a protection error.
  • ProtectionStopped. Protection is disabled.

Parameter properties

Type:ItemProtectionState
Default value:None
Accepted values:IRPending, ProtectionError, Protected, ProtectionStopped, BackupsSuspended
Supports wildcards:False
DontShow:False

Parameter sets

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

-ProtectionStatus

Specifies the overall protection status of an item in the container. The acceptable values for this parameter are:

  • Healthy
  • Unhealthy

Parameter properties

Type:ItemProtectionStatus
Default value:None
Accepted values:Healthy, Unhealthy
Supports wildcards:False
DontShow:False

Parameter sets

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

-UseSecondaryRegion

Filters from Secondary Region for Cross Region Restore

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

-WorkloadType

Workload type of the resource. The acceptable values for this parameter are:

  • AzureVM
  • AzureFiles
  • MSSQL
  • FileFolder
  • SAPHanaDatabase

Parameter properties

Type:WorkloadType
Default value:None
Accepted values:AzureVM, AzureFiles, MSSQL, FileFolder, SAPHanaDatabase
Supports wildcards:False
DontShow:False

Parameter sets

GetItemsForContainer
Position:5
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
GetItemsForVault
Position:5
Mandatory:True
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

ContainerBase

String

Outputs

ItemBase