Edit

Share via


Add-AzureProvisioningConfig

Adds provisioning configuration for an Azure virtual machine.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Windows (Default)

Add-AzureProvisioningConfig
    -VM <IPersistentVM>
    [-DisableGuestAgent]
    [-CustomDataFile <String>]
    [-Windows]
    [-AdminUsername <String>]
    [-Password <String>]
    [-ResetPasswordOnFirstLogon]
    [-DisableAutomaticUpdates]
    [-NoRDPEndpoint]
    [-TimeZone <String>]
    [-Certificates <CertificateSettingList>]
    [-EnableWinRMHttp]
    [-DisableWinRMHttps]
    [-WinRMCertificate <X509Certificate2>]
    [-X509Certificates <X509Certificate2[]>]
    [-NoExportPrivateKey]
    [-NoWinRMEndpoint]
    [-Profile <AzureSMProfile>]
    [-InformationAction <ActionPreference>]
    [-InformationVariable <String>]
    [<CommonParameters>]

Linux

Add-AzureProvisioningConfig
    -VM <IPersistentVM>
    [-DisableGuestAgent]
    [-Linux]
    [-LinuxUser <String>]
    [-DisableSSH]
    [-NoSSHEndpoint]
    [-NoSSHPassword]
    [-SSHPublicKeys <SSHPublicKeyList>]
    [-SSHKeyPairs <SSHKeyPairList>]
    [-CustomDataFile <String>]
    [-Password <String>]
    [-Profile <AzureSMProfile>]
    [-InformationAction <ActionPreference>]
    [-InformationVariable <String>]
    [<CommonParameters>]

WindowsDomain

Add-AzureProvisioningConfig
    -VM <IPersistentVM>
    -AdminUsername <String>
    -JoinDomain <String>
    -Domain <String>
    -DomainUserName <String>
    -DomainPassword <String>
    [-DisableGuestAgent]
    [-CustomDataFile <String>]
    [-WindowsDomain]
    [-Password <String>]
    [-ResetPasswordOnFirstLogon]
    [-DisableAutomaticUpdates]
    [-NoRDPEndpoint]
    [-TimeZone <String>]
    [-Certificates <CertificateSettingList>]
    [-MachineObjectOU <String>]
    [-EnableWinRMHttp]
    [-DisableWinRMHttps]
    [-WinRMCertificate <X509Certificate2>]
    [-X509Certificates <X509Certificate2[]>]
    [-NoExportPrivateKey]
    [-NoWinRMEndpoint]
    [-Profile <AzureSMProfile>]
    [-InformationAction <ActionPreference>]
    [-InformationVariable <String>]
    [<CommonParameters>]

Description

The Add-AzureProvisioningConfig cmdlet adds provisioning configuration information to an Azure virtual machine configuration. You can use the configuration object to create a virtual machine.

This cmdlet supports different provisioning configurations, including standalone Windows servers, Windows servers joined to an Active Directory domain, and Linux-based servers.

To create an Active Directory domain joined server, specify the fully qualified domain name of the Active Directory domain and the domain credentials of a user who has permission to join the virtual machine to the domain.

Examples

Example 1: Create a standalone virtual machine

PS C:\> New-AzureVMConfig -Name "NonDomainVM" -InstanceSize Small -ImageName "Image07" | Add-AzureProvisioningConfig -Windows -Password "password" -AdminUsername "AdminMain" | New-AzureVM -ServiceName "ContosoService"

This command creates a virtual machine configuration object by using the New-AzureVMConfig cmdlet. The command passes that object to the current cmdlet by using the pipeline operator. The current cmdlet adds provisioning configuration for a virtual machine that runs the Windows operating system. The configuration includes the administrator user name and password. The command passes the configuration to the New-AzureVM cmdlet, which creates the virtual machine.

Example 2: Create a domain joined virtual machine

PS C:\> New-AzureVMConfig -Name "DomainVM" -InstanceSize Small -ImageName "Image09" | Add-AzureProvisioningConfig -WindowsDomain -Password "password" -AdminUsername "AdminMain" -ResetPasswordOnFirstLogon -JoinDomain "contoso.com" -Domain "contoso" -DomainUserName "DomainAdminUser" -DomainPassword "DomainPassword" -MachineObjectOU 'OU=AzureVMs,DC=contoso,DC=com' | New-AzureVM -ServiceName "ContosoService"

This command creates a virtual machine configuration object, and then passes it to the current cmdlet. The current cmdlet adds provisioning configuration for a virtual machine to be joined with the contoso domain. The command includes user name and password necessary to join the virtual machine to the domain. The configuration requires the user to change the user password at the first logon. The command creates the virtual machine based on the provisioning object.

Example 3: Create a Linux-based virtual machine

PS C:\> New-AzureVMConfig -Name "LinuxVM" -InstanceSize Small -ImageName "LinuxImage03" | Add-AzureProvisioningConfig -Linux -LinuxUser "LinuxRoot" -Password "password" | New-AzureVM -ServiceName "ContosoService"

This command creates a virtual machine configuration object, and then passes it to the current cmdlet. The current cmdlet adds provisioning configuration for a virtual machine that runs the Linux operating system. The configuration includes the root user name and password. The command creates the virtual machine based on the provisioning object.

Example 4: Create a virtual machine that includes certificates for WinRM

PS C:\> $certs = Get-ChildItem Cert:\CurrentUser\My
New-AzureVMConfig -Name "NonDomainVM" -InstanceSize Small -ImageName "Image11" | Add-AzureProvisioningConfig -Windows -Password "password" -AdminUsername "AdminMain" -WinRMCertificate $certs[0] -X509Certificates $certs[1], $certs[2] | New-AzureVM -ServiceName "ContosoService" -WaitForBoot

The first command gets certificates from a certificate store, and then stores them in the $certs array variable.

The second command creates a virtual machine configuration object, and then passes it to the current cmdlet. The current cmdlet adds provisioning configuration that includes certificates for WinRM. The command creates the virtual machine based on the provisioning object.

Example 5: Create a virtual machine that has WinRM enabled over HTTP

PS C:\> New-AzureVMConfig -Name "NonDomainVM" -InstanceSize Small -ImageName "Image14" | Add-AzureProvisioningConfig -Windows -Password "password" -AdminUsername "AdminMain" -EnableWinRMHttp | New-AzureVM -ServiceName "ContosoService" -WaitForBoot

This command creates a virtual machine configuration object, and then passes it to the current cmdlet. The current cmdlet adds provisioning configuration that has WinRM enabled over HTTP. The command creates the virtual machine based on the provisioning object.

Example 6: Create a virtual machine that has WinRM disabled over HTTPS

PS C:\> New-AzureVMConfig -Name "NonDomainVM" -InstanceSize Small -ImageName "Image07" | Add-AzureProvisioningConfig -Windows -Password "password" -AdminUsername "AdminMain" -DisableWinRMHttps | New-AzureVM -ServiceName "ContosoService" -WaitForBoot

This command creates a virtual machine configuration object, and then passes it to the current cmdlet. The current cmdlet adds provisioning configuration that disables WinRM over HTTPS. The command creates the virtual machine based on the provisioning object.

Example 7: Create a virtual machine with no key export

PS C:\> $certs = Get-ChildItem Cert:\CurrentUser\My
New-AzureVMConfig -Name "NonDomainVM" -InstanceSize Small -ImageName "Image07" | Add-AzureProvisioningConfig -Windows -Password "password" -AdminUsername "AdminMain" -X509Certificates $certs[0], $certs[1] -NoExportPrivateKey | New-AzureVM -ServiceName "ContosoService" -WaitForBoot

The first command gets certificates from a certificate store, and then stores them in the $certs array variable.

The second command creates a virtual machine configuration object, and then passes it to the current cmdlet. The current cmdlet adds provisioning configuration for a virtual machine that includes certificates and does not export private keys. The command creates the virtual machine based on the provisioning object.

Parameters

-AdminUsername

Specifies the user name of the Administrator account that this configuration creates on the virtual machine.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Certificates

Specifies a set of certificates that this configuration installs on the virtual machine.

Parameter properties

Type:CertificateSettingList
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
WindowsDomain
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CustomDataFile

Specifies a data file for the virtual machine. This cmdlet encodes the contents of the file as Base64. The file must be less than 64 kilobytes long.

If the guest operating system is the Windows operating system, this configuration saves this data as a binary file named %SYSTEMDRIVE%\AzureData\CustomData.bin.

If the guest operating system is Linux, this configuration passes the data by using the ovf-env.xml file. Configuration copies that file to the /var/lib/waagent directory. The agent also stores the Base64 encoded data in /var/lib/waagent/CustomData.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisableAutomaticUpdates

Indicates that this configuration disables automatic updates.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
WindowsDomain
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisableGuestAgent

Indicates that this configuration disables the infrastructure as a service (IaaS) guest agent.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisableSSH

Indicates that this configuration disables SSH.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Linux
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisableWinRMHttps

Indicates that this configuration disables Windows Remote Management (WinRM) on HTTPS. By default, WinRM is enabled over HTTPS.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
WindowsDomain
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Domain

Specifies the name of the domain of the account that has permission to add the computer to a domain.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WindowsDomain
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DomainPassword

Specifies the password of the user account that has permission to add the computer to a domain.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WindowsDomain
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DomainUserName

Specifies the name of the user account that has permission to add the computer to a domain.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WindowsDomain
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EnableWinRMHttp

Indicates that this configuration enables WinRM over HTTP.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
WindowsDomain
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

  • Continue
  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend

Parameter properties

Type:ActionPreference
Default value:None
Supports wildcards:False
DontShow:False
Aliases:infa

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InformationVariable

Specifies an information variable.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:iv

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-JoinDomain

Specifies the fully qualified domain name (FQDN) of the domain to join.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WindowsDomain
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Linux

Indicates that this configuration creates a Linux configuration.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Linux
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-LinuxUser

Specifies the user name of the Linux administrative account that this configuration creates on the virtual machine.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Linux
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MachineObjectOU

Specifies the fully qualified name of the organizational unit (OU) in which the configuration creates the computer account.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WindowsDomain
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NoExportPrivateKey

Indicates that this configuration does not upload the private key.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
WindowsDomain
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NoRDPEndpoint

Indicates that this configuration creates a virtual machine without a remote desktop endpoint.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
WindowsDomain
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NoSSHEndpoint

Indicates that this configuration creates a virtual machine without an SSH endpoint.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Linux
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NoSSHPassword

Indicates that this configuration creates a virtual machine without an SSH password.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Linux
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-NoWinRMEndpoint

Indicates that this configuration does not add a WinRM endpoint for the virtual machine.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
WindowsDomain
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Password

Specifies the password of the administrator account.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Profile

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

Parameter properties

Type:AzureSMProfile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResetPasswordOnFirstLogon

Indicates that the virtual machine requires the user to change the password at the first logon.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
WindowsDomain
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SSHKeyPairs

Specifies SSH key pairs.

Parameter properties

Type:SSHKeyPairList
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Linux
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SSHPublicKeys

Specifies SSH public keys.

Parameter properties

Type:SSHPublicKeyList
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Linux
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TimeZone

Specifies the time zone for the virtual machine, for example, Pacific Standard Time or Canada Central Standard Time.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
WindowsDomain
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VM

Specifies a virtual machine object.

Parameter properties

Type:IPersistentVM
Default value:None
Supports wildcards:False
DontShow:False
Aliases:InputObject

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Windows

Indicates that this configuration creates a standalone virtual machine that runs the Windows operating system.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WindowsDomain

Indicates that this configuration creates Windows server that is joined to an Active Directory domain.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WindowsDomain
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WinRMCertificate

Specifies a certificate that this configuration associates to a WinRM endpoint.

Parameter properties

Type:X509Certificate2
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
WindowsDomain
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-X509Certificates

Specifies an array of X509 certificates that are deployed to a hosted service.

Parameter properties

Type:

X509Certificate2[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Windows
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
WindowsDomain
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.