Users - Create Or Update

Create or replace an existing user profile. This operation can take a while to complete.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}?api-version=2018-09-15

URI Parameters

Name In Required Type Description
labName
path True

string

The name of the lab.

name
path True

string

The name of the user profile.

resourceGroupName
path True

string

The name of the resource group.

subscriptionId
path True

string

The subscription ID.

api-version
query True

string

Client API version.

Request Body

Name Type Description
location

string

The location of the resource.

properties.identity

UserIdentity

The identity of the user.

properties.secretStore

UserSecretStore

The secret store of the user.

tags

object

The tags of the resource.

Responses

Name Type Description
200 OK

User

OK

201 Created

User

Created

Other Status Codes

CloudError

BadRequest

Security

azure_auth

OAuth2 Implicit Grant

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation Access Microsoft Azure

Examples

Users_CreateOrUpdate

Sample Request

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{devtestlabName}/users/{userName}?api-version=2018-09-15

{
  "location": "{location}",
  "tags": {
    "tagName1": "tagValue1"
  },
  "properties": {
    "identity": {
      "principalName": "{principalName}",
      "principalId": "{principalId}",
      "tenantId": "{tenantId}",
      "objectId": "{objectId}",
      "appId": "{appId}"
    },
    "secretStore": {
      "keyVaultUri": "{keyVaultUri}",
      "keyVaultId": "{keyVaultId}"
    }
  }
}

Sample Response

{
  "properties": {
    "identity": {
      "principalName": "{principalName}",
      "principalId": "{principalId}",
      "tenantId": "{tenantId}",
      "objectId": "{objectId}",
      "appId": "{appId}"
    },
    "secretStore": {
      "keyVaultUri": "{keyVaultUri}",
      "keyVaultId": "{keyVaultId}"
    },
    "createdDate": "2018-10-01T18:40:48.1739018-07:00",
    "provisioningState": "Succeeded",
    "uniqueIdentifier": "{uniqueIdentifier}"
  },
  "id": "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}",
  "name": "{userName}",
  "type": "Microsoft.DevTestLab/labs/users",
  "location": "{location}",
  "tags": {
    "tagName1": "tagValue1"
  }
}
{
  "properties": {
    "identity": {
      "principalName": "{principalName}",
      "principalId": "{principalId}",
      "tenantId": "{tenantId}",
      "objectId": "{objectId}",
      "appId": "{appId}"
    },
    "secretStore": {
      "keyVaultUri": "{keyVaultUri}",
      "keyVaultId": "{keyVaultId}"
    },
    "createdDate": "2018-10-01T18:40:48.1739018-07:00",
    "provisioningState": "Succeeded",
    "uniqueIdentifier": "{uniqueIdentifier}"
  },
  "id": "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}",
  "name": "{userName}",
  "type": "Microsoft.DevTestLab/labs/users",
  "location": "{location}",
  "tags": {
    "tagName1": "tagValue1"
  }
}

Definitions

Name Description
CloudError

Error from a REST request.

CloudErrorBody

Body of an error from a REST request.

User

Profile of a lab user.

UserIdentity

Identity attributes of a lab user.

UserSecretStore

Properties of a user's secret store.

CloudError

Error from a REST request.

Name Type Description
error

CloudErrorBody

The cloud error that occurred

CloudErrorBody

Body of an error from a REST request.

Name Type Description
code

string

The error code.

details

CloudErrorBody[]

Inner errors.

message

string

The error message.

target

string

The error target.

User

Profile of a lab user.

Name Type Description
id

string

The identifier of the resource.

location

string

The location of the resource.

name

string

The name of the resource.

properties.createdDate

string

The creation date of the user profile.

properties.identity

UserIdentity

The identity of the user.

properties.provisioningState

string

The provisioning status of the resource.

properties.secretStore

UserSecretStore

The secret store of the user.

properties.uniqueIdentifier

string

The unique immutable identifier of a resource (Guid).

tags

object

The tags of the resource.

type

string

The type of the resource.

UserIdentity

Identity attributes of a lab user.

Name Type Description
appId

string

Set to the app Id of the client JWT making the request.

objectId

string

Set to the object Id of the client JWT making the request. Not all users have object Id. For CSP (reseller) scenarios for example, object Id is not available.

principalId

string

Set to the principal Id of the client JWT making the request. Service principal will not have the principal Id.

principalName

string

Set to the principal name / UPN of the client JWT making the request.

tenantId

string

Set to the tenant ID of the client JWT making the request.

UserSecretStore

Properties of a user's secret store.

Name Type Description
keyVaultId

string

The ID of the user's Key vault.

keyVaultUri

string

The URI of the user's Key vault.