Edit

Share via


Remove-AzVmssVMDataDisk

Removes a data disk from a virtual machine scale set VM

Syntax

Default (Default)

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.

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

-Lun

Specifies the logical unit number of the disk.

Parameter properties

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

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VirtualMachineScaleSetVM

The virtual machine scale set VM profile.

Parameter properties

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

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
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

PSVirtualMachineScaleSetVM

Outputs

PSVirtualMachineScaleSetVM