Edit

cloudPcOnPremisesConnection: updateAdDomainPassword

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Update the Active Directory domain join credential for a successful cloudPcOnPremisesConnection. This API is supported when the connectionType of the cloudPcOnPremisesConnection object is hybridAzureADJoin.

Important

On-premises network connection has been renamed as Azure network connection. cloudPcOnPremisesConnection objects here are equivalent to Azure network connection for the Cloud PC product.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet
✅ ✅ ❌ ❌

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) CloudPC.ReadWrite.All Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application CloudPC.ReadWrite.All Not available.

HTTP request

POST /deviceManagement/virtualEndpoint/onPremisesConnections/{id}/updateAdDomainPassword

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON representation of the parameters.

The following table shows the parameters that you can use with this action.

Going forward, use the domainJoinCredential or the deprecated adDomainPassword parameter for backward compatibility. If both parameters are provided, domainJoinCredential takes precedence. If neither parameter is supplied, the request returns a 400 Bad Request response code.

Parameter Type Description
domainJoinCredential cloudPcDomainJoinCredential The Active Directory domain join credential. Set @odata.type to #microsoft.graph.cloudPcPlainTextDomainJoinCredential to update the username and password directly or to #microsoft.graph.cloudPcKeyVaultDomainJoinCredential to retrieve the password from a customer-owned Azure Key Vault. Required unless adDomainPassword is provided.
adDomainPassword (deprecated) String The new password for the service account identified by adDomainUsername on the connection. Optional when domainJoinCredential is provided; otherwise required. This parameter is deprecated and will be removed on December 31, 2026. Going forward, use the domainJoinCredential parameter instead.

Response

If successful, this action returns a 204 No Content response code.

Examples

Example 1: Update the password using the deprecated adDomainPassword parameter

The following example shows how to update a password using the deprecated adDomainPassword parameter. Going forward use domainJoinCredential as shown in the following examples.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/onPremisesConnections/07f12770-a225-4957-9127-0d247cf4ffff/updateAdDomainPassword
Content-Type: application/json

{
  "adDomainPassword": "AdDomainPassword_XXXX"
}

Response

The following example shows the response.

HTTP/1.1 204 No Content

Example 2: Update the user principal name and password

The following example rotates the domain join credential by providing the user principal name and password using the domainJoinCredential parameter.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/onPremisesConnections/07f12770-a225-4957-9127-0d247cf4ffff/updateAdDomainPassword
Content-Type: application/json

{
  "domainJoinCredential": {
    "@odata.type": "#microsoft.graph.cloudPcPlainTextDomainJoinCredential",
    "domainUserPrincipalName": "dcadmin@contoso.com",
    "domainPassword": "ExamplePassword!42"
  }
}

Response

The following example shows the response.

HTTP/1.1 204 No Content

Example 3: Use a password stored in Azure Key Vault

The following example configures the domain join credential to retrieve its password from an Azure Key Vault secret.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/onPremisesConnections/07f12770-a225-4957-9127-0d247cf4ffff/updateAdDomainPassword
Content-Type: application/json

{
  "domainJoinCredential": {
    "@odata.type": "#microsoft.graph.cloudPcKeyVaultDomainJoinCredential",
    "keyVaultResourceId": "/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c585ad47/resourceGroups/contoso-rg/providers/Microsoft.KeyVault/vaults/contoso-kv",
    "secretName": "ad-domain-join-password",
    "serviceConnectorResourceId": "/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c585ad47/resourceGroups/contoso-rg/providers/Microsoft.Windows365/serviceConnectors/anc-kv-connector",
    "keyVaultIntentConfiguration": {
      "@odata.type": "#microsoft.graph.cloudPcDomainJoinKeyVaultPasswordConfiguration",
      "userIdentity": {
        "@odata.type": "#microsoft.graph.cloudPcDomainJoinPlainTextUserIdentity",
        "domainUserPrincipalName": "dcadmin@contoso.com"
      }
    }
  }
}

Response

The following example shows the response.

HTTP/1.1 204 No Content