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
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>]
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>]
Add-AzureProvisioningConfig
-VM <IPersistentVM>
[-DisableGuestAgent]
[-CustomDataFile <String>]
-AdminUsername <String>
[-WindowsDomain]
[-Password <String>]
[-ResetPasswordOnFirstLogon]
[-DisableAutomaticUpdates]
[-NoRDPEndpoint]
[-TimeZone <String>]
[-Certificates <CertificateSettingList>]
-JoinDomain <String>
-Domain <String>
-DomainUserName <String>
-DomainPassword <String>
[-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.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Certificates
Specifies a set of certificates that this configuration installs on the virtual machine.
Type: | CertificateSettingList |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisableAutomaticUpdates
Indicates that this configuration disables automatic updates.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisableGuestAgent
Indicates that this configuration disables the infrastructure as a service (IaaS) guest agent.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisableSSH
Indicates that this configuration disables SSH.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisableWinRMHttps
Indicates that this configuration disables Windows Remote Management (WinRM) on HTTPS. By default, WinRM is enabled over HTTPS.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Domain
Specifies the name of the domain of the account that has permission to add the computer to a domain.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DomainPassword
Specifies the password of the user account that has permission to add the computer to a domain.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DomainUserName
Specifies the name of the user account that has permission to add the computer to a domain.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EnableWinRMHttp
Indicates that this configuration enables WinRM over HTTP.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InformationAction
Specifies how this cmdlet responds to an information event.
The acceptable values for this parameter are:
- Continue
- Ignore
- Inquire
- SilentlyContinue
- Stop
- Suspend
Type: | ActionPreference |
Aliases: | infa |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InformationVariable
Specifies an information variable.
Type: | String |
Aliases: | iv |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-JoinDomain
Specifies the fully qualified domain name (FQDN) of the domain to join.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Linux
Indicates that this configuration creates a Linux configuration.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-LinuxUser
Specifies the user name of the Linux administrative account that this configuration creates on the virtual machine.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-MachineObjectOU
Specifies the fully qualified name of the organizational unit (OU) in which the configuration creates the computer account.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NoExportPrivateKey
Indicates that this configuration does not upload the private key.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NoRDPEndpoint
Indicates that this configuration creates a virtual machine without a remote desktop endpoint.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NoSSHEndpoint
Indicates that this configuration creates a virtual machine without an SSH endpoint.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NoSSHPassword
Indicates that this configuration creates a virtual machine without an SSH password.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NoWinRMEndpoint
Indicates that this configuration does not add a WinRM endpoint for the virtual machine.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Password
Specifies the password of the administrator account.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | 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.
Type: | AzureSMProfile |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResetPasswordOnFirstLogon
Indicates that the virtual machine requires the user to change the password at the first logon.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SSHKeyPairs
Specifies SSH key pairs.
Type: | SSHKeyPairList |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SSHPublicKeys
Specifies SSH public keys.
Type: | SSHPublicKeyList |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-TimeZone
Specifies the time zone for the virtual machine, for example, Pacific Standard Time or Canada Central Standard Time.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-VM
Specifies a virtual machine object.
Type: | IPersistentVM |
Aliases: | InputObject |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Windows
Indicates that this configuration creates a standalone virtual machine that runs the Windows operating system.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WindowsDomain
Indicates that this configuration creates Windows server that is joined to an Active Directory domain.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WinRMCertificate
Specifies a certificate that this configuration associates to a WinRM endpoint.
Type: | X509Certificate2 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-X509Certificates
Specifies an array of X509 certificates that are deployed to a hosted service.
Type: | X509Certificate2[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |