Skip to main content

Create Or Update Virtual Machine

The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation.

External Documentation

To learn more, visit the Azure documentation.

Basic Parameters

ParameterDescription
Encryption Settings EnabledSpecifies whether disk encryption should be enabled on the virtual machine.
Hardware Profile Vm SizeSpecifies the size of the virtual machine. For more information about virtual machine sizes, see Sizes for virtual machines.The available VM sizes depend on region and availability set. For a list of available sizes use these APIs:List all available virtual machine sizes in an availability setList all available virtual machine sizes in a regionList all available virtual machine sizes for resizing.
LocationResource location.
Network Profile Network InterfacesSpecifies the list of resource Ids for the network interfaces associated with the virtual machine.
Os Disk Create OptionSpecifies how the virtual machine should be created.Possible values are:Attach \u2013 This value is used when you are using a specialized disk to create the virtual machine.FromImage \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described.
Os Disk Os TypeThis property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD.Possible values are:WindowsLinux.
Os Disk Write Accelerator EnabledSpecifies whether writeAccelerator should be enabled or disabled on the disk.
Resource Group NameThe name of the resource group.
Subscription IDSubscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
VM NameThe name of the virtual machine.

Advanced Parameters

ParameterDescription
Additional Capabilities Ultra SSDEnabledThe flag that enables or disables a capability to have one or more managed data disks with UltraSSDLRS storage account type on the VM or VMSS. Managed disks with storage account type UltraSSDLRS can be added to a virtual machine or virtual machine scale set only if this property is enabled.
Availability Set IDResource Id.
Billing Profile Max PriceSpecifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. This price is in US Dollars.This price will be compared with the current Azure Spot price for the VM size. Also, the prices are compared at the time of create/update of Azure Spot VM/VMSS and the operation will only succeed if the maxPrice is greater than the current Azure Spot price.The maxPrice will also be used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice after creation of VM/VMSS.Possible values are:
  • Any decimal value greater than zero. Example: 0.01538
-1 – indicates default price to be up-to on-demand.You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS should not be evicted for price reasons. Also, the default max price is -1 if it is not provided by you.Minimum api-version: 2019-03-01.
Boot Diagnostics Console Screenshot Blob UriThe console screenshot blob URI.
Boot Diagnostics EnabledWhether boot diagnostics should be enabled on the Virtual Machine.
Boot Diagnostics Serial Console Log Blob UriThe Linux serial console log blob Uri.
Boot Diagnostics Storage UriUri of the storage account to use for placing the console output and screenshot.
Diff Disk Settings OptionSpecifies the ephemeral disk option for operating system disk.
Disk Encryption Key Secret URLThe URL referencing a secret in a Key Vault.
Disk Encryption Key Source Vault IDResource Id.
Disk Encryption Set IDResource Id.
Host IDResource Id.
IDResource Id.
Identity Principal IDThe principal id of virtual machine identity. This property will only be provided for a system assigned identity.
Identity Tenant IDThe tenant id associated with the virtual machine. This property will only be provided for a system assigned identity.
Identity TypeThe type of identity used for the virtual machine. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine.
Identity User Assigned IdentitiesThe list of user identities associated with the Virtual Machine. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
Image Reference Exact VersionSpecifies in decimal numbers, the version of platform image or marketplace image used to create the virtual machine. This readonly field differs from 'version', only if the value specified in 'version' field is 'latest'.
Image Reference IDResource Id.
Image Reference OfferSpecifies the offer of the platform image or marketplace image used to create the virtual machine.
Image Reference PublisherThe image publisher.
Image Reference SkuThe image SKU.
Image Reference VersionSpecifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available.
Image UriSpecifies the virtual hard disk's uri.
Instance View Computer NameThe computer name assigned to the virtual machine.
Instance View DisksThe virtual machine disk information.
Instance View ExtensionsThe extensions information.
Instance View Hyper VGenerationSpecifies the HyperVGeneration Type associated with a resource.
Instance View Os NameThe Operating System running on the virtual machine.
Instance View Os VersionThe version of Operating System running on the virtual machine.
Instance View Platform Fault DomainSpecifies the fault domain of the virtual machine.
Instance View Platform Update DomainSpecifies the update domain of the virtual machine.
Instance View Rdp Thumb PrintThe Remote desktop certificate thumbprint.
Instance View StatusesThe resource status information.
Key Encryption Key Key URLThe URL referencing a key encryption key in Key Vault.
Key Encryption Key Source Vault IDResource Id.
Linux Configuration Disable Password AuthenticationSpecifies whether password authentication should be disabled.
Linux Configuration Provision VMAgentIndicates whether virtual machine agent should be provisioned on the virtual machine.When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later.
Maintenance Redeploy Status Is Customer Initiated Maintenance AllowedTrue, if customer is allowed to perform Maintenance.
Maintenance Redeploy Status Last Operation MessageMessage returned for the last Maintenance Operation.
Maintenance Redeploy Status Last Operation Result CodeThe Last Maintenance Operation Result Code.
Maintenance Redeploy Status Maintenance Window End TimeEnd Time for the Maintenance Window.
Maintenance Redeploy Status Maintenance Window Start TimeStart Time for the Maintenance Window.
Maintenance Redeploy Status Pre Maintenance Window End TimeEnd Time for the Pre Maintenance Window.
Maintenance Redeploy Status Pre Maintenance Window Start TimeStart Time for the Pre Maintenance Window.
Managed Disk Disk Encryption SetDescribes the parameter of customer managed disk encryption set resource id that can be specified for disk.NOTE: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details.
Managed Disk IDResource Id.
Managed Disk Storage Account TypeSpecifies the storage account type for the managed disk. NOTE: UltraSSDLRS can only be used with data disks. It cannot be used with OS Disk. StandardLRS uses Standard HDD. StandardSSDLRS uses Standard SSD. PremiumLRS uses Premium SSD. UltraSSD_LRS uses Ultra disk. For more information regarding disks supported for Windows Virtual Machines, refer to https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types and, for Linux Virtual Machines, refer to https://docs.microsoft.com/en-us/azure/virtual-machines/linux/disks-types.
NameResource name.
Os Disk CachingSpecifies the caching requirements.Possible values are:NoneReadOnlyReadWriteDefault: None for Standard storage. ReadOnly for Premium storage.
Os Disk Disk Size GBSpecifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image.This value cannot be larger than 1023 GB.
Os Disk NameThe disk name.
Os Profile Admin PasswordSpecifies the password of the administrator account.Minimum-length (Windows): 8 charactersMinimum-length (Linux): 6 charactersMax-length (Windows): 123 charactersMax-length (Linux): 72 charactersComplexity requirements: 3 out of 4 conditions below need to be fulfilled Has lower charactersHas upper characters Has a digit Has a special character (Regex match [\W_])Disallowed values: "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!"For resetting the password, see How to reset the Remote Desktop service or its login password in a Windows VMFor resetting root password, see Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension.
Os Profile Admin UsernameSpecifies the name of the administrator account.This property cannot be updated after the VM is created.Windows-only restriction: Cannot end in "."Disallowed values: "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".Minimum-length (Linux): 1 characterMax-length (Linux): 64 charactersMax-length (Windows): 20 charactersFor root access to the Linux VM, see Using root privileges on Linux virtual machines in Azure For a list of built-in system users on Linux that should not be used in this field, see Selecting User Names for Linux on Azure.
Os Profile Allow Extension OperationsSpecifies whether extension operations should be allowed on the virtual machine.This may only be set to False when no extensions are present on the virtual machine.
Os Profile Computer NameSpecifies the host OS name of the virtual machine.This name cannot be updated after the VM is created.Max-length (Windows): 15 charactersMax-length (Linux): 64 characters.For naming conventions and restrictions see Azure infrastructure services implementation guidelines.
Os Profile Custom DataSpecifies 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.Note: Do not pass any secrets or passwords in customData propertyThis property cannot be updated after the VM is created.customData is passed to the VM to be saved as a file, for more information see Custom Data on Azure VMsFor using cloud-init for your Linux VM, see Using cloud-init to customize a Linux VM during creation.
Os Profile Require Guest Provision SignalSpecifies whether the guest provision signal is required to infer provision success of the virtual machine.
Os Profile SecretsSpecifies set of certificates that should be installed onto the virtual machine.
Plan NameThe plan ID.
Plan ProductSpecifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element.
Plan Promotion CodeThe promotion code.
Plan PublisherThe publisher ID.
Properties Eviction PolicySpecifies the eviction policy for the Azure Spot VM/VMSS.
Properties License TypeSpecifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system.Possible values are:Windows_ClientWindows_ServerIf this element is included in a request for an update, the value must match the initial value. This value cannot be updated.For more information, see Azure Hybrid Use Benefit for Windows ServerMinimum api-version: 2015-06-15.
Properties PrioritySpecifies the priority for a standalone virtual machine or the virtual machines in the scale set.'Low' enum will be deprecated in the future, please use 'Spot' as the enum to deploy Azure Spot VM/VMSS.
Properties Provisioning StateThe provisioning state, which only appears in the response.
Proximity Placement Group IDResource Id.
ResourcesThe virtual machine child extension resources.
Ssh Public KeysThe list of SSH public keys used to authenticate with linux based VMs.
Status CodeThe status code.
Status Display StatusThe short localizable label for the status.
Status LevelThe level code.
Status MessageThe detailed status message, including for alerts and error messages.
Status TimeThe time of the status.
Storage Profile Data DisksSpecifies the parameters that are used to add a data disk to a virtual machine.For more information about disks, see About disks and VHDs for Azure virtual machines.
TagsResource tags.
TypeResource type.
VM IDSpecifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands.
Vhd UriSpecifies the virtual hard disk's uri.
Virtual Machine Scale Set IDResource Id.
Vm Agent Extension HandlersThe virtual machine extension handler instance view.
Vm Agent StatusesThe resource status information.
Vm Agent Vm Agent VersionThe VM Agent full version.
Win RM ListenersThe list of Windows Remote Management listeners.
Windows Configuration Additional Unattend ContentSpecifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup.
Windows Configuration Enable Automatic UpdatesIndicates whether Automatic Updates is enabled for the Windows virtual machine. Default value is true.For virtual machine scale sets, this property can be updated and updates will take effect on OS reprovisioning.
Windows Configuration Provision VMAgentIndicates whether virtual machine agent should be provisioned on the virtual machine.When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later.
Windows Configuration Time ZoneSpecifies the time zone of the virtual machine. e.g. "Pacific Standard Time".Possible values can be TimeZoneInfo.Id value from time zones returned by TimeZoneInfo.GetSystemTimeZones.
ZonesThe virtual machine zones.

Example Output

{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM",
"type": "Microsoft.Compute/virtualMachines",
"properties": {
"osProfile": {
"adminUsername": "{your-username}",
"secrets": [],
"computerName": "myVM",
"windowsConfiguration": {
"provisionVMAgent": true,
"enableAutomaticUpdates": true
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic",
"properties": {
"primary": true
}
}
]
},
"storageProfile": {
"osDisk": {
"name": "myVMosdisk",
"image": {
"uri": "https://{existing-storage-account-name}.blob.core.windows.net/system/Microsoft.Compute/Images/vhds/{existing-generalized-os-image-blob-name}.vhd"
},
"caching": "ReadWrite",
"createOption": "FromImage",
"osType": "Windows",
"vhd": {
"uri": "http://{existing-storage-account-name}.blob.core.windows.net/vhds/myDisk.vhd"
}
},
"dataDisks": []
},
"vmId": "926cd555-a07c-4ff5-b214-4aa4dd09d79b",
"hardwareProfile": {
"vmSize": "Standard_D1_v2"
},
"provisioningState": "Creating"
},
"name": "myVM",
"location": "westus"
}

Workflow Library Example

Create or Update Virtual Machine with Azure and Send Results Via Email

Workflow LibraryPreview this Workflow on desktop