編集

次の方法で共有


Remove-AzVmss

Removes the VMSS or a virtual machine that is within the VMSS.

Syntax

Remove-AzVmss
      [-ResourceGroupName] <String>
      [-VMScaleSetName] <String>
      [[-InstanceId] <String[]>]
      [-ForceDeletion <Boolean>]
      [-Force]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-AzVmss cmdlet removes the Virtual Machine Scale Set (VMSS) from Azure. This cmdlet can also be used to remove a specific virtual machine inside the VMSS. You can use the InstanceId parameter to remove a specific virtual machine inside the VMSS.

Examples

Example 1: Remove a VMSS

Remove-AzVmss -ResourceGroupName "Group001" -VMScaleSetName "VMScaleSet001"

This command removes the VMSS named VMScaleSet001 that belongs to the resource group named Group001.

Example 2: Remove a virtual machine from within a VMSS

Remove-AzVmss -ResourceGroupName "Group002" -VMScaleSetName "VMScaleSet002" -InstanceId "3";

This command removes the virtual machine with instance ID 3 from the VMSS named VMScaleSet002 that belongs to the resource group named Group002.

Parameters

-AsJob

Run cmdlet in the background and return a Job to track progress.

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

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required: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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ForceDeletion

Optional parameter to force delete a VM.

Type:Nullable<T>[Boolean]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InstanceId

Specifies, as a string array, the ID of the instances that need to be started. For instance: -InstanceId "0", "3"

Type:String[]
Position:2
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

Specifies the name of the resource group that the VMSS belongs to.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VMScaleSetName

Species the name of the VMSS that this cmdlet removes. If you specify the InstanceId parameter, the cmdlet will remove the specified virtual machine from the VMSS named by this parameter.

Type:String
Aliases:Name
Position:1
Default value:None
Required:True
Accept pipeline input:True
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

String[]

Outputs

PSOperationStatusResponse