Remove-AzureVM

Removes an Azure virtual machine.

Syntax

Remove-AzureVM
      [-ServiceName] <String>
      [-Name] <String>
      [-DeleteVHD]
      [-InformationAction <ActionPreference>]
      [-InformationVariable <String>]
      [-Profile <AzureSMProfile>]
      [-Confirm]
      [-WhatIf]
      [<CommonParameters>]

Description

The Remove-AzureVM cmdlet deletes an Azure virtual machine. This process does not delete the underlying .vhd files of the disks mounted on that virtual machine.

Examples

Example 1: Remove a virtual machine from a service

PS C:\> Remove-AzureVM -ServiceName "ContosoService03" -Name "VirtualMachine03"

This command removes the virtual machine named VirtualMachine03 that runs in the ContosoService03 service.

Example 2: Remove a virtual machine and delete the .vhd files

PS C:\> Remove-AzureVM -ServiceName "ContosoService03" -Name "VirtualMachine04" -DeleteVHD

This command removes the VirtualMachine04 virtual machine that runs in the ContosoService03 service, and specifies to remove the .vhd files using the DeleteVHD parameter.

Required Parameters

-Name

Specifies the name of the virtual machine being removed.

Type:String
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServiceName

Specifies the name of the Azure service from which the virtual machine is being removed.

Type:String
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
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
-DeleteVHD

Specifies whether this cmdlet removes the virtual machine and the underlying disk blobs.

Type:SwitchParameter
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

  • Continue
  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
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
-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