Edit

Share via


Unregister-AzRecoveryServicesBackupContainer

Unregisters a Windows Server or other container from the vault.

Syntax

Default (Default)

Unregister-AzRecoveryServicesBackupContainer
    [-Container] <ContainerBase>
    [-PassThru]
    [-Force]
    [-VaultId <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Unregister-AzRecoveryServicesBackupContainer cmdlet unregisters a Windows Server or other Backup container from the vault. This cmdlet removes references to a container from the vault. Before you can unregister a container, you must delete any protected data associated with that container. Set the vault context by using the Set-AzRecoveryServicesVaultContext cmdlet before you use the current cmdlet.

Examples

Example 1: Unregister a Windows Server from the vault

$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
$Cont = Get-AzRecoveryServicesBackupContainer -ContainerType "Windows" -BackupManagementType MAB -VaultId $vault.ID
Unregister-AzRecoveryServicesBackupContainer -Container $Cont

The first command gets the Windows container named server01.contoso.com that is registered in the vault, and then stores it in the $Cont variable. The second command unregisters the specified Windows Server from the Azure Backup vault.

Example 2

Unregisters a Windows Server or other container from the vault. (autogenerated)

Unregister-AzRecoveryServicesBackupContainer -Container $Cont -VaultId $vault.ID

Example 3: Unregister a MSSQL container from the vault

$vault = Get-AzRecoveryServicesVault -ResourceGroupName "resourceGroup" -Name "vaultName"
$Cont = Get-AzRecoveryServicesBackupContainer -ContainerType AzureVMAppContainer -BackupManagementType AzureWorkload -VaultId $vault.ID | Where-Object { $_.Name -match "pstest-vm" }
Unregister-AzRecoveryServicesBackupContainer -Container $Cont
WorkloadName     Operation            Status               StartTime                 EndTime                   JobID
------------     ---------            ------               ---------                 -------                   -----
sql-pstest-vm2   UnRegister           Completed            1/3/2024 6:26:54 AM       1/3/2024 6:29:18 AM       f8626j98-8027-7h89-aa77-1a7ed83f5645

The first command gets the container with Name like "pstest-vm" that is registered in the vault, and then stores it in the $Cont variable. The second command unregisters the specified backup container from the recovery services vault and outputs the backup job to monitor and track completion.

Parameters

-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

-Container

Specifies a Backup container object to unregister. To obtain a BackupContainer object, use the Get-AzRecoveryServicesBackupContainer cmdlet.

Parameter properties

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

Parameter sets

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

-Force

Force unregisters container (prevents confirmation dialog). This parameter is optional.

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

-PassThru

Return the container to be deleted.

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

-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

String

Outputs

ContainerBase