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

Set-AzureVMOperatingSystem

microsoft.azure.commands.compute.dll

Synopsis

Set the OS properties for the VM

Syntax

Set-AzureVMOperatingSystem [-VM] [-Windows] [-ComputerName] [-Credential] [-CustomData] [-ProvisionVMAgent] [-EnableAutoUpdate] [-TimeZone] [-WinRMHttp] [-WinRMHttps] [-WinRMCertificateUrl] [-Profile] [-InformationAction] [-InformationVariable] [<CommonParameters>]

Set-AzureVMOperatingSystem [-VM] [-Linux] [-ComputerName] [-Credential] [-CustomData] [-DisablePasswordAuthentication] [-Profile] [-InformationAction] [-InformationVariable] [<CommonParameters>]

Detailed Description

This cmdlet allows you to set the OS properties such as login credentials, computer name etc.

Parameters

-VM <PSVirtualMachine>

The local VM object to set the OS properties on

Aliases

None

Required?

true

Position

0

Default value

None

Accept pipeline input?

true (ByValue, ByPropertyName)

Accept wildcard characters?

false

-Windows <SwitchParameter>

Specify the type of OS is Windows

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-ComputerName <String>

Name of the computer

Aliases

None

Required?

true

Position

2

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Credential <PSCredential>

PSCredential object that contains username and password for the VM

Aliases

None

Required?

true

Position

3

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-CustomData <String>

Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes.

Linux - The file is copied to /var/lib/waagent/ovf-env.xml by the Azure Linux Agent. The agent will also place the base-64 encoded data in /var/lib/waagent/CustomData during provisioning.

Windows – The file is saved to %SYSTEMDRIVE%\AzureData\CustomData.bin. If the file exists, it is overwritten. The security on directory is set to System:Full Control and Administrators:Full Control.

Aliases

None

Required?

false

Position

4

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-ProvisionVMAgent <SwitchParameter>

Indicates that the VM agent should be installed on the VM

Aliases

None

Required?

false

Position

5

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-EnableAutoUpdate <SwitchParameter>

Aliases

None

Required?

false

Position

6

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-TimeZone <String>

Aliases

None

Required?

false

Position

7

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-WinRMHttp <SwitchParameter>

Aliases

None

Required?

false

Position

8

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-WinRMHttps <SwitchParameter>

Aliases

None

Required?

false

Position

9

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-WinRMCertificateUrl <Uri>

URL of certificate in KeyVault to be used for WinRM HTTPS

Aliases

None

Required?

false

Position

10

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Profile <AzureProfile>

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-InformationAction <ActionPreference>

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-InformationVariable <String>

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Linux <SwitchParameter>

Specify the type of OS is Linux

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-DisablePasswordAuthentication <SwitchParameter>

Aliases

None

Required?

false

Position

5

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-Secrets <list`1[psvaultsecretgroup]>

Secrets config that specifies the source KeyVault and Certificate url. Use the Add-AzureVMSecret cmdlet to create this config.

Aliases

None

Required?

false

Position

5

Default value

None

Accept pipeline input?

true (ByValue, ByPropertyName)

Accept wildcard characters?

false

-AdditionalUnattendContents <list`1[psadditionalunattendcontent]>

AdditionalUnattendContent config. Use the Add-AzureVMAdditionalUnattendContent cmdlet to create this.

Aliases

None

Required?

false

Position

12

Default value

None

Accept pipeline input?

true (ByValue, ByPropertyName)

Accept wildcard characters?

false

-SSHPublicKey <string[]>

SSH public key for the VM

Aliases

None

Required?

false

Position

5

Default value

None

Accept pipeline input?

true (ByValue, ByPropertyName)

Accept wildcard characters?

false

Input Type


Return Type


Notes

Examples

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

$user = "Foo12";
$password = 'BaR@123';
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
$computerName = 'test2';
$winRMCertUrl = "http://keyVaultName.vault.azure.net/secrets/secretName/secretVersion";
$timeZone = "Pacific Standard Time";
$custom = "echo 'Hello World'";
$encodedCustom = "ZWNobyAnSGVsbG8gV29ybGQn";

# Create the VM Profile
$vm = New-AzureVMConfig –VMName “myVM” -AvailabilitySetID $as1.Id –VMSize “Standard_A1"

# Set OS properties
$vm = Set-AzureVMOperatingSystem -VM $vm -Windows -ComputerName $computerName -Credential $cred -CustomData $custom -WinRMHttp -WinRMHttps -WinRMCertificateUrl $winRMCertUrl -ProvisionVMAgent -EnableAutoUpdate -TimeZone $timeZone;