Set-​Azure​Site​Recovery​Protection​Entity

Sets the state for a Site Recovery protection entity.

Syntax

Set-AzureSiteRecoveryProtectionEntity
   [-Force]
   -Id <String>
   [-OS <String>]
   [-OSDiskName <String>]
   [-Profile <AzureSMProfile>]
   -Protection <String>
   -ProtectionContainerId <String>
   [-ProtectionProfile <ASRProtectionProfile>]
   [-WaitForCompletion]
   [-Confirm]
   [-WhatIf]
   [<CommonParameters>]
Set-AzureSiteRecoveryProtectionEntity
   [-Force]
   [-OS <String>]
   [-OSDiskName <String>]
   [-Profile <AzureSMProfile>]
   -Protection <String>
   -ProtectionEntity <ASRProtectionEntity>
   [-ProtectionProfile <ASRProtectionProfile>]
   [-WaitForCompletion]
   [-Confirm]
   [-WhatIf]
   [<CommonParameters>]

Description

The Set-AzureSiteRecoveryProtectionEntity cmdlet enables or disables protection on an Azure Site Recovery protection entity.

Examples

Example 1: Enable protection for objects in a container

PS C:\> $ProtectionContainer = Get-AzureSiteRecoveryProtectionContainer -Name "Cloud17"
PS C:\> $ProtectionEntity = Get-AzureSiteRecoveryProtectionEntity -ProtectionContainer $ProtectionContainer -Name "VM01"
PS C:\> Set-AzureSiteRecoveryProtectionEntity -ProtectionEntity $ ProtectionEntity -Protection Enable -ProtectionProfile $ProtectionContainer.AvailableProtectionProfiles[0] -OS Windows

The first command gets containers for the current Azure Site vault by using the Get-AzureSiteRecoveryProtectionContainer cmdlet, and then stores it in the $ProtectionContainer variable.

The second command gets the protected virtual machines that belong to the container stored in $ProtectionContainer by using the Get-AzureSiteRecoveryProtectionEntity cmdlet. The command stores the results in the $ProtectionEntity variable.

The final command enables protection for the entities stored in $ProtectionEntity.

Required Parameters

-Id

Specifies the ID of a protected virtual machine for which to enable or disable protection.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Protection

Specifies whether protection should be enabled or disabled. The acceptable values for this parameter are:

  • Enable
  • Disable
Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ProtectionContainerId

Specifies the ID of a protected container. This cmdlet enables or disables protection for a virtual machine that belongs to the container that this parameter specifies.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ProtectionEntity

Specifies the protection entity object.

Type:ASRProtectionEntity
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-OS

Specifies the operating system type. The acceptable values for this parameter are:

  • Windows
  • Linux
Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-OSDiskName

Specifies the name of the disk that contains the operating system.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ProtectionProfile

Specifies a protection profile to enable protection. Specify an ASRProtectionProfile object that is one of the available protection profiles in the associated protection container.

Type:ASRProtectionProfile
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WaitForCompletion

Indicates that the cmdlet waits for the operation to complete before it returns control to the Windows PowerShell console.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False