Redigera

Dela via


Remove-AzVmssVMDataDisk

Removes a data disk from a virtual machine scale set VM

Syntax

Remove-AzVmssVMDataDisk
      [-VirtualMachineScaleSetVM] <PSVirtualMachineScaleSetVM>
      [-Lun] <Int32>
      [-DefaultProfile <IAzureContextContainer>]
      [<CommonParameters>]

Description

The Remove-AzVmssVMDataDisk cmdlet removes a data disk from a VM scale set VM

Examples

Example 1: Remove a data disk from a VM scale set VM

$VmssVM = Get-AzVmssVM -ResourceGroupName "myrg" -VMScaleSetName "myvmss" -InstanceId 0 
Remove-AzVmssVMDataDisk -VirtualMachineScaleSetVM $VirtualMachine -Lun 0
Update-AzVmssVM -VirtualMachineScaleSetVM $VmssVM

The first command getsan existing Vmss VM given by the resource group name, the vmss name and the instance ID. The second command removes the data disk lun 0 from the VM scale set VM stored in $VmssVM The final command updates the Vmss VM with removed data disk.

Parameters

-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

-Lun

Specifies the logical unit number of the disk.

Type:Int32
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-VirtualMachineScaleSetVM

The virtual machine scale set VM profile.

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

Inputs

PSVirtualMachineScaleSetVM

Outputs

PSVirtualMachineScaleSetVM