< Back

Set-AzureDataDisk

Wed Jan 30, 2019 5:53 pm

NAME Set-AzureDataDisk



SYNOPSIS

Modifies the host caching of an existing data disk on an Azure virtual machine.





SYNTAX

Set-AzureDataDisk [-HostCaching] <String> [-LUN] <Int32> -VM <IPersistentVM> [-Profile <AzureSMProfile>] [-InformationAction <ActionPreference>]

[-InformationVariable <String>] [<CommonParameters>]



Set-AzureDataDisk [-DiskName] <String> [-ResizedSizeInGB] <Int32> -VM <IPersistentVM> [-Profile <AzureSMProfile>] [-InformationAction

<ActionPreference>] [-InformationVariable <String>] [<CommonParameters>]





DESCRIPTION

The Set-AzureDataDisk cmdlet modifies the cache attributes of an existing data disk on an Azure virtual machine. Specify which data disk to update by

its logical unit number (LUN).





PARAMETERS

-HostCaching <String>

Specifies the host level caching settings of the disk. Valid values are:



-- None



-- ReadOnly



-- ReadWrite



Required? true

Position? 0

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-LUN <Int32>

Specifies the LUN for the data drive in the virtual machine. Valid values are: 0 through 15.



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-VM <IPersistentVM>

Specifies the virtual machine object that is attached to the data disk. To obtain a virtual machine object, use the Get-AzureVM cmdlet.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByValue, ByPropertyName)

Accept wildcard characters? false



-Profile <AzureSMProfile>

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InformationAction <ActionPreference>





Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-InformationVariable <String>





Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DiskName <String>

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



Required? true

Position? 3

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ResizedSizeInGB <Int32>

Specifies the new size, in gigabytes, for the data disk. The new size must be larger than the current size.



Required? true

Position? 4

Default value None

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 (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES









-------------------------- Example 1: Modify the host caching for a data disk --------------------------



PS C:\\>Get-AzureVM "ContosoService" | Set-AzureDataDisk -VM "VirtualMachine07" -LUN 2 -HostCaching ReadOnly | Update-AzureVM



This command gets the virtual machines that run on the service named ContosoService by using the Get-AzureVM cmdlet. The command passes them to the

current cmdlet by using the pipeline operator. That cmdlet sets the data disk at LUN 2 of the virtual machine named VirtualMachine07 to use ReadOnly

host caching. The command updates the virtual machine to reflect your changes by using the Update-AzureVM cmdlet.

-------------------------- Example 2: Modify the host caching for all data disks on a virtual machine --------------------------



PS C:\\>Get-AzureVM "ContosoService" -Name "VirtualMachine07" | Get-AzureDataDisk | Set-AzureDataDisk -HostCaching ReadWrite | Update-AzureVM



This command gets an object for the virtual machine named VirtualMachine07 on the ContosoService cloud service. The command passes it to the

Get-AzureDataDisk cmdlet, which gets the data disks for that virtual machine. The current cmdlet then sets the host caching mode of each data disks to

ReadWrite. The command updates the virtual machine to reflect your changes.



RELATED LINKS

Add-AzureDataDisk

Get-AzureVM

Get-AzureDataDisk

Remove-AzureDataDisk

Update-AzureVM