< Back

Set-AzureRmVMDataDisk

Tue Jan 29, 2019 9:39 pm

NAME Set-AzureRmVMDataDisk



SYNOPSIS

Modifies properties of a virtual machine data disk.





SYNTAX

Set-AzureRmVMDataDisk [-VM] <PSVirtualMachine> [-Lun] <Int32> [[-Caching] {None | ReadOnly | ReadWrite}] [[-DiskSizeInGB] <Int32>]

[-DefaultProfile <IAzureContextContainer>] [-StorageAccountType <String>] [-WriteAccelerator] [<CommonParameters>]



Set-AzureRmVMDataDisk [-VM] <PSVirtualMachine> [-Name] <String> [[-Caching] {None | ReadOnly | ReadWrite}] [[-DiskSizeInGB] <Int32>]

[-DefaultProfile <IAzureContextContainer>] [-StorageAccountType <String>] [-WriteAccelerator] [<CommonParameters>]





DESCRIPTION

The Set-AzureRmVMDataDisk cmdlet modifies properties of a virtual machine data disk.





PARAMETERS

-Caching <CachingTypes>

Specifies the caching mode of the disk. The acceptable values for this parameter are:



- ReadOnly



- ReadWrite





The default value is ReadWrite. Changing this value causes the virtual machine to restart.

This setting affects the consistency and performance of the disk.





Required? false

Position? 2

Default value None

Accept pipeline input? True (ByPropertyName)

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



-DiskSizeInGB <Int32>

Specifies the size, in gigabytes, for the data disk.



Required? false

Position? 3

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Lun <Int32>

Specifies the logical unit number (LUN) of the data disk that this cmdlet modifies.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Name <String>

Specifies the name of the data disk that this cmdlet modifies.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-StorageAccountType <String>

The virtual machine managed disk's account type.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VM <PSVirtualMachine>

Specifies the virtual machine for which this cmdlet modifies 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



-WriteAccelerator [<SwitchParameter>]

Specifies whether WriteAccelerator should be enabled or disabled on the data disk.



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: Modify the caching mode of a data disk



PS C:\\> $VM = Get-AzureRMVM -ResourceGroupName "ResourceGroup11" -VMName "ContosoVM07"

PS C:\\> Set-AzureRmVMDataDisk -VM $VM -Name "DataDisk01" -Caching ReadWrite | Update-AzureRmVM



The first command gets the virtual machine named ContosoVM07 by using Get-AzureRmVM . The command stores it in the $VM variable.



The second command modifies the caching mode for the data disk named DataDisk01 on the virtual machine in $VM. The command passes the result to

the Update-AzureRmVM cmdlet, which implements your changes. A change to the cashing mode causes the virtual machine to restart.







RELATED LINKS

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

Get-AzureRmVmssDiskEncryption

Update-AzureRmVmss