---
title: "POST /providers/Microsoft.LabServices/users/{userName}/getEnvironment"
method: POST
path: "/providers/Microsoft.LabServices/users/{userName}/getEnvironment"
tags: ["GlobalUsers"]
---

# POST /providers/Microsoft.LabServices/users/{userName}/getEnvironment

`POST /providers/Microsoft.LabServices/users/{userName}/getEnvironment`

Gets the virtual machine details

## Path parameters

- `userName` string, required

## Query parameters

- `$expand` string
- `api-version` string, required

## Request body

- EnvironmentOperationsPayload — Represents payload for any Environment operations like get, start, stop, connect
  - `environmentId` string, required — The resourceId of the environment

## Response `200`

OK

- GetEnvironmentResponse — Represents the environments details
  - `environment` EnvironmentDetails — This represents the details about a User's environment and its state.
    - `name` string — Name of the Environment
    - `description` string — Description of the Environment
    - `id` string — Resource Id of the environment
    - `provisioningState` string — The provisioning state of the environment. This also includes LabIsFull and NotYetProvisioned status.
    - `virtualMachineDetails` VirtualMachineDetails — Details of the backing virtual machine.
      - `provisioningState` string — Provisioning state of the Dtl VM
      - `rdpAuthority` string — Connection information for Windows
      - `sshAuthority` string — Connection information for Linux
      - `privateIpAddress` string — PrivateIp address of the compute VM
      - `userName` string — Compute VM login user name
      - `lastKnownPowerState` string — Last known compute power state captured in DTL
    - `latestOperationResult` LatestOperationResult — Details of the status of an operation.
      - `status` string — The current status of the operation.
      - `errorCode` string — Error code on failure.
      - `errorMessage` string — The error message.
      - `requestUri` string — Request URI of the operation.
      - `httpMethod` string — The HttpMethod - PUT/POST/DELETE for the operation.
      - `operationUrl` string — The URL to use to check long-running operation status
    - `environmentState` string — Publishing state of the environment setting Possible values are Creating, Created, Failed
    - `totalUsage` string, duration — How long the environment has been used by a lab user
    - `passwordLastReset` string, date-time — When the password was last reset on the environment.

## Other responses

- `default` — BadRequest

---

[API](https://skmtc.net/azure/apis/managedlabsclient.md) · [All operations](https://skmtc.net/azure/apis/managedlabsclient/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/azure/managedlabsclient/versions/c5b9e6b8da98/schema)
