Edit

Share via


Move-AzVirtualMachineToVmss

Migrates a virtual machine from an Availability Set to a Flexible Virtual Machine Scale Set.

Syntax

ResourceGroupNameParameterSetName (Default)

Move-AzVirtualMachineToVmss
    [-ResourceGroupName] <String>
    [-Name] <String>
    [-TargetZone <String>]
    [-TargetFaultDomain <Int32>]
    [-TargetVMSize <String>]
    [-NoWait]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

IdParameterSetName

Move-AzVirtualMachineToVmss
    [-Id] <String>
    [-TargetZone <String>]
    [-TargetFaultDomain <Int32>]
    [-TargetVMSize <String>]
    [-NoWait]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Move-AzVirtualMachineToVmss cmdlet migrates a virtual machine from an Availability Set to a Flexible Virtual Machine Scale Set. This operation triggers a downtime on the virtual machine. Use this cmdlet after starting the migration with Start-AzAvailabilitySetMigration.

This feature requires the subscription to be enabled for the feature flag Microsoft.Compute/MigrateToVmssFlex.

Examples

Example 1: Migrate a virtual machine to a VMSS

Move-AzVirtualMachineToVmss -ResourceGroupName "MyResourceGroup" -Name "VM1"

This command migrates the virtual machine named VM1 in the resource group MyResourceGroup to the Flexible Virtual Machine Scale Set that was specified when migration was started.

Example 2: Migrate a virtual machine with specific target settings

Move-AzVirtualMachineToVmss -ResourceGroupName "MyResourceGroup" -Name "VM1" -TargetZone "1" -TargetFaultDomain 0 -TargetVMSize "Standard_DS2_v2"

This command migrates the virtual machine with specific target zone, fault domain, and VM size settings.

Example 3: Migrate a virtual machine using resource ID

Move-AzVirtualMachineToVmss -Id "/subscriptions/{sub-id}/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/VM1" -TargetZone "1"

This command migrates the virtual machine specified by its resource ID to zone 1.

Parameters

-AsJob

Run cmdlet in the background

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

-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

-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

-Id

The ID of the virtual machine.

Parameter properties

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

Parameter sets

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

-Name

The virtual machine name.

Parameter properties

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

Parameter sets

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

-NoWait

Starts the operation and returns immediately, before the operation is completed. In order to determine if the operation has successfully been completed, use some other mechanism.

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

-ResourceGroupName

Specifies the name of the resource group.

Parameter properties

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

Parameter sets

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

-TargetFaultDomain

The target compute fault domain for the virtual machine migration to Flexible Virtual Machine Scale Set.

Parameter properties

Type:

Nullable<T>[Int32]

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:True
Value from remaining arguments:False

-TargetVMSize

The target Virtual Machine size for the migration to Flexible Virtual Machine Scale Set.

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:True
Value from remaining arguments:False

-TargetZone

The target zone for the virtual machine migration to Flexible Virtual Machine Scale Set.

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:True
Value from remaining arguments:False

-WhatIf

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

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

Nullable<T>

Outputs

PSComputeLongRunningOperation

PSAzureOperationResponse