Set-AzureVMOSDisk

Set-AzureVMOSDisk

Sets the operating system disk properties on a virtual machine.

Syntax

Parameter Set: LinuxParamSet
Set-AzureVMOSDisk [-VM] <PSVirtualMachine> [-Name] <String> [[-VhdUri] <String> ] [[-Caching] <String> {ReadOnly | ReadWrite} ] [[-SourceImageUri] <System.String> ] [-CreateOption] <System.String> {empty | attach | fromImage} [[-Linux]] [-Profile <AzureProfile> ] [ <CommonParameters>]

Parameter Set: WindowsParamSet
Set-AzureVMOSDisk [-VM] <PSVirtualMachine> [-Name] <String> [[-VhdUri] <String> ] [[-Caching] <String> {ReadOnly | ReadWrite} ] [[-SourceImageUri] <System.String> ] [-CreateOption] <System.String> {empty | attach | fromImage} [[-Windows]] [-Profile <AzureProfile> ] [ <CommonParameters>]

Detailed Description

The Set-AzureVMOSDisk cmdlet set the operating system disk properties on a virtual machine.

Parameters

-Caching<String>

Specifies the caching mode of the operating system disk. Valid values are:

-- ReadOnly
-- ReadWrite

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

This setting affects the consistency and performance of the disk.

Aliases

none

Required?

false

Position?

4

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-CreateOption<System.String>

Specifies whether this cmldet creates a disk in the virtual machine from a platform or user image, creates an empty disk, or attaches an existing disk. Valid values are:

-- Attach
-- Empty
-- FromImage

This setting affects the consistency and performance of the disk.

Aliases

none

Required?

true

Position?

6

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-Linux

Indicates that the operating system on the user image is Linux. Specify this parameter for user image based virtual machine deployment.

Aliases

none

Required?

false

Position?

7

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of the operating system disk.

Aliases

OSDiskName,DiskName

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

-SourceImageUri<System.String>

This setting affects the consistency and performance of the disk.

Aliases

SourceImage

Required?

false

Position?

5

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-VhdUri<String>

Specifies the Uniform Resource Identifier (URI) of a virtual hard disk (VHD).

For an image based virtual machine, this parameter specifies the VHD file to create when a platform image or user image is specified. This is the location from which the image binary large object (BLOB) is copied to start the virtual machine.

For a disk based virtual machine boot scenario, this parameter specifies the VHD file that the virtual machine uses directly for starting up.

Aliases

OSDiskVhdUri,DiskVhdUri

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-VM<PSVirtualMachine>

Specifies the local virtual machine object on which to set operating system disk properties. 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

-Windows

Indicates that the operating system on the user image is Windows.

Aliases

none

Required?

false

Position?

7

Default Value

none

Accept Pipeline Input?

true(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 (http://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: Sets properties on a virtual machine

The first command gets the availability set named AvailablitySet03 in the resource group named ResourceGroup11, and then stores that object in the $AvailabilitySet variable.

The second command creates a virtual machine object, and then stores it in the $VirtualMachine variable. The command assigns a name and size to the virtual machine. The virtual machine belongs to the availability set stored in $AvailabilitySet.

The final command sets the properties on the virtual machine in $VirtualMachine.

$AvailabilitySet = Get-AzureAvailabilitySet -ResourceGroupName "ResourceGroup11" -Name "AvailabilitySet03" 
PS C:\> $VirtualMachine = New-AzureVMConfig -VMName "VirtualMachine07" -VMSize "Standard_A1" -AvailabilitySetID $AvailabilitySet.Id 
PS C:\> Set-AzureVMOSDisk -VM $VirtualMachine -Name "OsDisk02" -VhdUri "os.vhd" -Caching ReadWrite

Get-AzureVM

Get-AzureAvailabilitySet

New-AzureVMConfig