# Method: domains.domainJoinMachine

- [HTTP request](https://docs.cloud.google.com/managed-microsoft-ad/reference/rest/v1beta1/projects.locations.global.domains/domainJoinMachine#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/managed-microsoft-ad/reference/rest/v1beta1/projects.locations.global.domains/domainJoinMachine#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/managed-microsoft-ad/reference/rest/v1beta1/projects.locations.global.domains/domainJoinMachine#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/managed-microsoft-ad/reference/rest/v1beta1/projects.locations.global.domains/domainJoinMachine#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/managed-microsoft-ad/reference/rest/v1beta1/projects.locations.global.domains/domainJoinMachine#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/managed-microsoft-ad/reference/rest/v1beta1/projects.locations.global.domains/domainJoinMachine#body.DomainJoinMachineResponse.SCHEMA_REPRESENTATION)
- [Authorization Scopes](https://docs.cloud.google.com/managed-microsoft-ad/reference/rest/v1beta1/projects.locations.global.domains/domainJoinMachine#body.aspect)
- [Try it!](https://docs.cloud.google.com/managed-microsoft-ad/reference/rest/v1beta1/projects.locations.global.domains/domainJoinMachine#try-it)

**Full name**: projects.locations.global.domains.domainJoinMachine

domains.domainJoinMachine API joins a Compute Engine VM to the domain

### HTTP request

`POST https://managedidentities.googleapis.com/v1beta1/{domain=projects/*/locations/global/domains/*}:domainJoinMachine`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `domain` | `string` Required. The domain resource name using the form: projects/{projectId}/locations/global/domains/{domainName} Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `domain`: - `managedidentities.domains.domainJoinMachine` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "vmIdToken": string, "ouName": string } ``` |

| Fields ||
|---|---|
| `vmIdToken` | `string` Required. Full instance id token of compute engine VM to verify instance identity. More about this: <https://cloud.google.com/compute/docs/instances/verifying-instance-identity#request_signature> |
| `ouName` | `string` Optional. OU name to which the VM needs to be domain joined. If the field is not provided, the VM is joined to the default OU which is created. The default OU for the domain join api is created as GCE Instances under the Cloud OU. Example - OU=GCE Instances,OU=Cloud,DC=ad,DC=test,DC=com If the field is provided, then the custom OU is searched for under GCE Instances OU. Example - if ouName=test_ou then the VM is domain joined to the following OU: OU=test_ou,OU=GCE Instances,OU=Cloud,DC=ad,DC=test,DC=com if present. If OU is not present under GCE Instances, then error is returned. |

### Response body

If successful, the response body contains data with the following structure:
DomainJoinMachineResponse is the response message for domains.domainJoinMachine method

| JSON representation |
|---|
| ``` { "domainJoinBlob": string } ``` |

| Fields ||
|---|---|
| `domainJoinBlob` | `string` The response is the offline domain join blob that is returned after running the djoin command. To correctly use the response of the API, please refer to the sample usage. |

### Authorization Scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://cloud.google.com/docs/authentication/).