---
title: "POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment"
method: POST
path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment"
tags: ["Labs"]
---

# POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment

`POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment`

Create virtual machines in a lab. This operation can take a while to complete.

## Path parameters

- `subscriptionId` string, required
- `resourceGroupName` string, required
- `name` string, required

## Query parameters

- `api-version` string, required

## Request body

- LabVirtualMachineCreationParameter — Properties for creating a virtual machine.
  - `properties` LabVirtualMachineCreationParameterProperties — Properties for virtual machine creation.
    - `bulkCreationParameters` BulkCreationParameters — Parameters for creating multiple virtual machines as a single action.
      - `instanceCount` integer — The number of virtual machine instances to create.
    - `notes` string — The notes of the virtual machine.
    - `ownerObjectId` string — The object identifier of the owner of the virtual machine.
    - `ownerUserPrincipalName` string — The user principal name of the virtual machine owner.
    - `createdDate` string, date-time — The creation date of the virtual machine.
    - `customImageId` string — The custom image identifier of the virtual machine.
    - `size` string — The size of the virtual machine.
    - `userName` string — The user name of the virtual machine.
    - `password` string — The password of the virtual machine administrator.
    - `sshKey` string — The SSH key of the virtual machine administrator.
    - `isAuthenticationWithSshKey` boolean — Indicates whether this virtual machine uses an SSH key for authentication.
    - `labSubnetName` string — The lab subnet name of the virtual machine.
    - `labVirtualNetworkId` string — The lab virtual network identifier of the virtual machine.
    - `disallowPublicIpAddress` boolean — Indicates whether the virtual machine is to be created without a public IP address.
    - `artifacts` ArtifactInstallProperties[] — The artifacts to be installed on the virtual machine.
      - `artifactId` string — The artifact's identifier.
      - `artifactTitle` string — The artifact's title.
      - `parameters` ArtifactParameterProperties[] — The parameters of the artifact.
        - `name` string — The name of the artifact parameter.
        - `value` string — The value of the artifact parameter.
      - `status` string — The status of the artifact.
      - `deploymentStatusMessage` string — The status message from the deployment.
      - `vmExtensionStatusMessage` string — The status message from the virtual machine extension.
      - `installTime` string, date-time — The time that the artifact starts to install on the virtual machine.
    - `galleryImageReference` GalleryImageReference — The reference information for an Azure Marketplace image.
      - `offer` string — The offer of the gallery image.
      - `publisher` string — The publisher of the gallery image.
      - `sku` string — The SKU of the gallery image.
      - `osType` string — The OS type of the gallery image.
      - `version` string — The version of the gallery image.
    - `planId` string — The id of the plan associated with the virtual machine image
    - `networkInterface` NetworkInterfaceProperties — Properties of a network interface.
      - `virtualNetworkId` string — The resource ID of the virtual network.
      - `subnetId` string — The resource ID of the sub net.
      - `publicIpAddressId` string — The resource ID of the public IP address.
      - `publicIpAddress` string — The public IP address.
      - `privateIpAddress` string — The private IP address.
      - `dnsName` string — The DNS name.
      - `rdpAuthority` string — The RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol).
      - `sshAuthority` string — The SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH.
      - `sharedPublicIpAddressConfiguration` SharedPublicIpAddressConfiguration — Properties of a virtual machine that determine how it is connected to a load balancer.
        - `inboundNatRules` InboundNatRule[] — The incoming NAT rules
          - `transportProtocol` 'Tcp' | 'Udp' — The transport protocol for the endpoint.
          - `frontendPort` integer — The external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically.
          - `backendPort` integer — The port to which the external traffic will be redirected.
    - `expirationDate` string, date-time — The expiration date for VM.
    - `allowClaim` boolean — Indicates whether another user can take ownership of the virtual machine
    - `storageType` string — Storage type to use for virtual machine (i.e. Standard, Premium).
    - `environmentId` string — The resource ID of the environment that contains this virtual machine, if any.
    - `dataDiskParameters` DataDiskProperties[] — New or existing data disks to attach to the virtual machine after creation
      - `attachNewDataDiskOptions` AttachNewDataDiskOptions — Properties to attach new disk to the Virtual Machine.
        - `diskSizeGiB` integer — Size of the disk to be attached in Gibibytes.
        - `diskName` string — The name of the disk to be attached.
        - `diskType` 'Standard' | 'Premium' | 'StandardSSD' — The storage type for the disk (i.e. Standard, Premium).
      - `existingLabDiskId` string — Specifies the existing lab disk id to attach to virtual machine.
      - `hostCaching` 'None' | 'ReadOnly' | 'ReadWrite' — Caching option for a data disk (i.e. None, ReadOnly, ReadWrite).
    - `scheduleParameters` ScheduleCreationParameter[] — Virtual Machine schedules to be created
      - `properties` ScheduleCreationParameterProperties — Properties for schedule creation.
        - `status` 'Enabled' | 'Disabled' — The status of the schedule (i.e. Enabled, Disabled)
        - `taskType` string — The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart).
        - `weeklyRecurrence` WeekDetails — Properties of a weekly schedule.
          - `weekdays` string[] — The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.).
          - `time` string — The time of the day the schedule will occur.
        - `dailyRecurrence` DayDetails — Properties of a daily schedule.
          - `time` string — The time of day the schedule will occur.
        - `hourlyRecurrence` HourDetails — Properties of an hourly schedule.
          - `minute` integer — Minutes of the hour the schedule will run.
        - `timeZoneId` string — The time zone ID (e.g. China Standard Time, Greenland Standard Time, Pacific Standard time, etc.). The possible values for this property can be found in `IReadOnlyCollection<string> TimeZoneConverter.TZConvert.KnownWindowsTimeZoneIds` (https://github.com/mattjohnsonpint/TimeZoneConverter/blob/main/README.md)
        - `notificationSettings` NotificationSettings — Notification settings for a schedule.
          - `status` 'Enabled' | 'Disabled' — If notifications are enabled for this schedule (i.e. Enabled, Disabled).
          - `timeInMinutes` integer — Time in minutes before event at which notification will be sent.
          - `webhookUrl` string — The webhook URL to which the notification will be sent.
          - `emailRecipient` string — The email recipient to send notifications to (can be a list of semi-colon separated email addresses).
          - `notificationLocale` string — The locale to use when sending a notification (fallback for unsupported languages is EN).
        - `targetResourceId` string — The resource ID to which the schedule belongs
      - `name` string — The name of the virtual machine or environment
      - `location` string — The location of the new virtual machine or environment
      - `tags` object — The tags of the resource.
  - `name` string — The name of the virtual machine or environment
  - `location` string — The location of the new virtual machine or environment
  - `tags` object — The tags of the resource.

## Response `200`

OK

## Other responses

- `202` — Accepted
- `default` — BadRequest

---

[API](https://skmtc.dev/azure/apis/devtestlabsclient.md) · [All operations](https://skmtc.dev/azure/apis/devtestlabsclient/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/azure/devtestlabsclient/revisions/a1f17c27e170/schema)
