external help file | Module Name | ms.assetid | online version | schema |
---|---|---|---|---|
Microsoft.Azure.PowerShell.Cmdlets.RecoveryServices.Backup.dll-Help.xml |
Az.RecoveryServices |
F671A7CC-2A27-460E-B064-2FBF1B9C6A0B |
2.0.0 |
Waits for a Backup job to finish.
Wait-AzRecoveryServicesBackupJob [-Job] <Object> [[-Timeout] <Int64>] [-VaultId <String>]
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
The Wait-AzRecoveryServicesBackupJob cmdlet waits for an Azure Backup job to finish. Backup jobs can take a long time. If you run a backup job as part of a script, you may want to force the script to wait for job to finish before it continues to other tasks. A script that includes this cmdlet can be simpler than one that polls the Backup service for the job status. Set the vault context by using the -VaultId parameter.
$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
$Jobs = Get-AzRecoveryServicesBackupJob -Status InProgress -VaultId $vault.ID
Wait-AzRecoveryServicesBackupJob -Job $Jobs[0] -VaultId $vault.ID -Timeout 3600
This script polls the first job that is currently in progress until the job has completed or timeout period of 1 hour expired.
The credentials, account, tenant, and subscription used for communication with azure.
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Parameter Sets: (All)
Aliases: AzContext, AzureRmContext, AzureCredential
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the job to wait for. To obtain a BackupJob object, use the Get-AzRecoveryServicesBackupJob cmdlet.
Type: System.Object
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies the maximum time, in seconds, that this cmdlet waits for the job to finish. It is recommended to specify a time-out value.
Type: System.Nullable`1[System.Int64]
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
ARM ID of the Recovery Services Vault.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.