# Join a Windows VM manually to a domain

This document explains how to join a Windows VM to a Managed Microsoft AD
domain.

## Before you begin

Before you begin, complete the following tasks:

- [Create a Managed Microsoft AD
  domain](https://docs.cloud.google.com/managed-microsoft-ad/docs/quickstart-create-domain).

- [Create a Windows
  VM](https://docs.cloud.google.com/compute/docs/create-windows-server-vm-instance#create_a_virtual_machine_instance).
  When you create the VM, make sure that you complete the following tasks:

  - Create the VM with a [Windows version that Managed Microsoft AD
    supports](https://docs.cloud.google.com/managed-microsoft-ad/docs/os-versions#windows-domain-join).
  - Create the VM in the project that hosts your Managed Microsoft AD domain. If your Managed Microsoft AD domain has [Shared VPC](https://docs.cloud.google.com/vpc/docs/shared-vpc.md.txt) as an authorized network, you can alternatively create the VM in any of the Shared VPC service projects.
  - Create the VM on a VPC network that you have peered with the Managed Microsoft AD domain.

## Join the Windows VM

Before you join the Windows VM to the domain, [connect to the Windows
VM](https://docs.cloud.google.com/compute/docs/instances/connecting-to-windows).

To join the VM to the domain, you need the following information:

- The [domain name](https://docs.cloud.google.com/managed-microsoft-ad/docs/list-describe-delete-domains.md.txt#getting_domain_info)
  of your Managed Microsoft AD domain.

- The username and password of an account that has permissions to join a VM to
  the domain. By default, members of the `Cloud Service Domain Join Accounts`
  group have these permissions. For more information about the default groups
  that Managed Microsoft AD creates, see
  [Groups](https://docs.cloud.google.com/managed-microsoft-ad/docs/objects.md.txt#groups).

You can join the Windows VM to the Managed Microsoft AD domain either using
the [Windows
GUI](https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/deployment/join-a-computer-to-a-domain)
or
[PowerShell](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/add-computer?view=powershell-5.1).

For information about common issues that you can encounter while joining a VM
manually to a domain, see [Unable to join a VM manually to a
domain](https://docs.cloud.google.com/managed-microsoft-ad/docs/troubleshooting#manual-domain-join).

## What's next

- [Join a Windows VM automatically to a
  domain](https://docs.cloud.google.com/managed-microsoft-ad/docs/seamless-domain-join-gce).

- [Manage Active Directory objects](https://docs.cloud.google.com/managed-microsoft-ad/docs/manage-active-directory-objects.md.txt) in your
  Managed Microsoft AD domain.

- [Connect to a Managed Microsoft AD
  domain](https://docs.cloud.google.com/managed-microsoft-ad/docs/connect-to-active-directory-domain).

- Learn about the [delegated administrator
  account](https://docs.cloud.google.com/managed-microsoft-ad/docs/how-to-use-delegated-admin).