Remove-AzStackHCIVMVirtualMachineDataDisk

The operation to delete a data disk from a virtual machine.

Syntax

Remove-AzStackHCIVMVirtualMachineDataDisk
      -ResourceId <String>
      [-DataDiskId <String[]>]
      [-DataDiskName <String[]>]
      [-DataDiskResourceGroup <String>]
      [-NoWait]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzStackHCIVMVirtualMachineDataDisk
      -Name <String>
      -ResourceGroupName <String>
      [-SubscriptionId <String>]
      [-DataDiskId <String[]>]
      [-DataDiskName <String[]>]
      [-DataDiskResourceGroup <String>]
      [-NoWait]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The operation to delete a data disk from a virtual machine.

Examples

Example 1: Removes a Data Disk from a Virtual Machine

Remove-AzStackHCIVMVirtualMachineDataDisk  -Name "testVm" -ResourceGroupName "test-rg"  -DataDiskName "testVhd"

Name            ResourceGroupName
----            -----------------
testVm          test-rg

This command removes a data disk from the virtual machine in the specified resource group.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-DataDiskId

Data Disks - list of data disks to be removed from the virtual machine in id format.

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

-DataDiskName

Data Disks - list of data disks to be removed from the virtual machine in name format.

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

-DataDiskResourceGroup

Resource Group of the Data Disks.

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

-Name

Name of the virtual machine

Type:String
Aliases:VirtualMachineName
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-NoWait

Run the command asynchronously

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

-ResourceGroupName

The name of the resource group. The name is case insensitive.

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

-ResourceId

The ARM Resource ID of the virtual machine.

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

-SubscriptionId

The ID of the target subscription.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
Required:False
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:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

IVirtualMachineInstance