Remove-AzureVMDataDisk
Remove-AzureVMDataDisk
Removes a data disk from a virtual machine.
Syntax
Parameter Set: Default
Remove-AzureVMDataDisk [-VM] <PSVirtualMachine> [-Name] <String> [-Profile <AzureProfile> ] [ <CommonParameters>]
Detailed Description
The Remove-AzureVMDataDisk cmdlet removes a data disk from a virtual machine.
Parameters
-Name<String>
Specifies the name of the data disk to add.
Aliases |
none |
Required? |
true |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
true(ByPropertyName) |
Accept Wildcard Characters? |
false |
-Profile<AzureProfile>
Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.
Aliases |
none |
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-AzureVM cmdlet.
Aliases |
VMProfile |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true(ByValue,ByPropertyName) |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Examples
Example 1: Remove a data disk from a virtual machine
The first command gets the virtual machine named VirtualMachine07 by using the Get-AzureVM 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.
$VirtualMachine = Get-AzureVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07"
PS C:\> Remove-AzureVMDataDisk -VM $VirtualMachine -Name "disk3"
PS C:\> Update-AzureVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -VM $VirtualMachine