Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Set-AzureDataDisk

Set-AzureDataDisk

microsoft.windowsazure.commands.servicemanagement.dll

Synopsis

Sets the host-cache mode on an existing data disk object.

Syntax

Set-AzureDataDisk [-HostCaching] [-LUN] [-VM] [<CommonParameters>]

Detailed Description

The Set-AzureDataDisk cmdlet updates the cache attributes of an existing data disk object on a Microsoft Azure virtual machine. The possible host caching values are: None, ReadOnly, and ReadWrite. You can specify which data disk to update by specifying its logical unit number (LUN).

Parameters

-HostCaching <String>

Sets the host level caching settings of the disk. Possible values are: None, ReadOnly and ReadWrite.

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-LUN <Int32>

Numerical value that defines the slot where the data drive is mounted in the virtual machine.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-VM <IPersistentVM>

The virtual machine where the data disk is mounted.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

true (ByValue, ByPropertyName)

Accept wildcard characters?

false

Input Type


Return Type


Notes

Examples

-------------------------- Example 1 --------------------------

This command gets the virtual machines running on the "myservice" cloud service, and then sets the data disk at LUN 2 of the "MyVM" virtual machine to use ReadOnly host caching.

PS C:\> C:\PS>Get-AzureVM "myservice" `
          | Set-AzureDataDisk -VM "MyVM" -LUN 2 -HostCaching ReadOnly | Update-AzureVM

-------------------------- Example 2 --------------------------

This command gets an object representing the "MyVM" virtual machine running on the "myservice" cloud service, gets an object or objects representing all the data disks on the virtual machine, and then sets the host caching mode of those data disks to ReadWrite.

PS C:\> C:\PS>Get-AzureVM "myservice" -Name "MyVM" `
          | Get-AzureDataDisk `
          | Set-AzureDataDisk -HostCaching ReadWrite '
          | Update-AzureVM

Add-AzureDataDisk
Get-AzureVM
Update-AzureVM