Set-AzureOSDisk

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Set-AzureOSDisk

Updates the host-cache mode of an Azure virtual machine operating system disk.

Syntax

Parameter Set: Default
Set-AzureOSDisk [-HostCaching] <String> -VM <IPersistentVM> [ <CommonParameters>]

Detailed Description

This topic describes the cmdlet in the 0.8.10 version of the Microsoft Azure PowerShell module. To get the version of the module you're using, in the Azure PowerShell console, type (Get-Module -Name Azure).Version.

The Set-AzureOSDisk cmdlet updates the host-cache mode of a virtual machine's operating system disk. The supported host cache modes are "ReadOnly" and "ReadWrite".

Caution: Running Set-AzureOSDisk on a running virtual machine will cause the virtual machine to reboot.

Parameters

-HostCaching<String>

Specifies the host cache attribute for the operating system disk. Acceptable values are: "ReadOnly" and "ReadWrite".

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VM<IPersistentVM>

Specifies the virtual machine for which to update the operating system disk.

Aliases

InputObject

Required?

true

Position?

named

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 --------------

This command sets the host cache mode of the operating system disk of the VM named "MyTestVM2" to ReadOnly.

C:\PS>Get-AzureVM -ServiceName $mySvc1 -name "MyTestVM2" | Set-AzureOSDisk –HostCaching "ReadOnly"

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

This command updates the host-cache mode of the operating system disk attached to the VM named "MyTestVM2" to ReadWrite.

C:\PS>$myVM2 = Get-AzureVM -ServiceName $mySvc1 -name "MyTestVM2" 
C:\PS>Set-AzureOSDisk "ReadWrite" –VM $myVM2 

Get-AzureOSDisk

Add-AzureVMImage

Get-AzureVMImage

Get-AzureVM

Update-AzureVM

Manage Virtual Machines Using Azure Cmdlets