Remove-AzureRmVmssVMDataDisk
Removes a data disk from a virtual machine scale set VM
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.
Syntax
Remove-AzureRmVmssVMDataDisk
[-VirtualMachineScaleSetVM] <PSVirtualMachineScaleSetVM>
[-Lun] <Int32>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Remove-AzureRmVmssVMDataDisk cmdlet removes a data disk from a VM scale set VM
Examples
Example 1: Remove a data disk from a VM scale set VM
PS C:\> $VmssVM = Get-AzureRmVmssVM -ResourceGroupName "myrg" -VMScaleSetName "myvmss" -InstanceId 0
PS C:\> Remove-AzureRmVmssVMDataDisk -VM $VirtualMachine -Lun 0
PS C:\> Update-AzureRmVmssVM -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: | 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 |