< Back

Remove-AzureRmVMDataDisk

Tue Jan 29, 2019 9:39 pm

NAME Remove-AzureRmVMDataDisk



SYNOPSIS

Removes a data disk from a virtual machine.





SYNTAX

Remove-AzureRmVMDataDisk [-VM] <PSVirtualMachine> [[-DataDiskNames] <String[]>] [-DefaultProfile <IAzureContextContainer>] [-Confirm] [-WhatIf]

[<CommonParameters>]





DESCRIPTION

The Remove-AzureRmVMDataDisk cmdlet removes a data disk from a virtual machine.





PARAMETERS

-DataDiskNames <String[]>

Specifies the names of one or more data disks that this cmdlet removes.



Required? false

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-VM <PSVirtualMachine>

Specifies the local virtual machine object from which to remove a data disk. To obtain a virtual machine object, use the Get-AzureRmVM cmdlet.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

PSVirtualMachine

Parameter 'VM' accepts value of type 'PSVirtualMachine' from the pipeline





OUTPUTS

Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine







NOTES









Example 1: Remove a data disk from a virtual machine



PS C:\\> $VirtualMachine = Get-AzureRmVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07"

PS C:\\> Remove-AzureRmVMDataDisk -VM $VirtualMachine -Name "Disk3"

PS C:\\> Update-AzureRmVM -ResourceGroupName "ResourceGroup11" -VM $VirtualMachine



The first command gets the virtual machine named VirtualMachine07 by using the Get-AzureRmVM cmdlet. The command stores the virtual machine in the

$VirtualMachine variable.



The second command removes the data disk named Disk3 from the virtual machine stored in $VirtualMachine.



The final command updates the state of the virtual machine stored in $VirtualMachine in ResourceGroup11.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... vmdatadisk

Add-AzureRmVMDataDisk

Get-AzureRmVmssDiskEncryption