Déployer Microsoft AD géré avec un accès interprojet à l'aide de l'appairage de domaines
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette rubrique explique comment configurer l'appairage de domaines entre le service géré pour Microsoft Active Directory (Microsoft AD géré) et le VPC partagé. Vous pouvez ainsi rendre Microsoft AD géré disponible pour les projets de service associés au VPC partagé.
Présentation
L'appairage de domaines dans Microsoft AD géré crée une ressource d'appairage de domaine dans chaque ressource de domaine et chaque projet de ressources VPC. Vous pouvez mettre le domaine Microsoft AD géré à la disposition de tous les projets associés au VPC partagé en créant un appairage de domaine entre Microsoft AD géré et le VPC partagé. Par exemple, vous pouvez vous authentifier et vous connecter à SQL Server à l'aide du domaine Microsoft AD géré, où SQL Server et Microsoft AD géré se trouvent dans différents projets de service associés au VPC partagé.
Avant de commencer
Avant de commencer, procédez comme suit :
Dans la console Google Cloud, sur la page de sélection du projet, sélectionnez ou créez trois Google Cloud projets. Il s'agit des projets hôte et de service. Le VPC partagé est activé dans le projet hôte. Le domaine Microsoft AD géré et les instances Cloud SQL doivent se trouver dans des projets de service différents. Les VM peuvent se trouver dans l'un des projets de service.
Activez le VPC partagé sur le projet hôte. Pour en savoir plus, consultez Activer un projet hôte.
Associez le ou les projets de service au réseau VPC partagé. L'API Compute Engine doit être activée pour chacun des projets. Pour les besoins de cet exemple, nous vous recommandons de créer des sous-réseaux distincts dans le VPC partagé. Lorsque vous associez le projet, choisissez le sous-réseau approprié pour chacun d'eux. Pour en savoir plus, consultez la section Associer des projets de service.
Créez un domaine Microsoft AD géré dans le projet de service. Le réseau VPC autorisé lors de la création du domaine Microsoft AD géré est indépendant des réseaux VPC partagés. Pour créer un domaine Microsoft AD géré sans réseau autorisé, utilisez la commande gcloud CLI.
Configurer l'appairage de domaines
Créez un appariement de domaines à partir du projet de service contenant la ressource de domaine et du réseau VPC partagé. Pour en savoir plus sur l'appairage de domaines, consultez Configurer l'appairage de domaines.
PEERING-RESOURCE-NAME: nom de votre ressource d'appairage de domaines (par exemple, my-domain-peering).
DOMAIN-RESOURCE-NAME : nom complet de la ressource de votre domaine Microsoft AD géré au format projects/PROJECT-ID/locations/global/domains/DOMAIN-NAME.
SHARED-VPC-NAME : nom complet de la ressource de votre réseau VPC partagé, au format projects/PROJECT-ID/global/networks/NETWORK-NAME.
Répertoriez les appairages de domaines pour vérifier leur état. Exécutez la commande de gcloud CLI suivante :
gcloud active-directory peerings list --project=PROJECT_ID
Remplacez PROJECT_ID par l'ID du projet de service utilisé pour créer votre ressource de peering de domaine.
Il renvoie l'état DISCONNECTED.
Créez l'appairage de domaine inverse à partir du projet hôte.
PEERING-RESOURCE-NAME: nom de votre ressource d'appairage de domaines (par exemple, my-domain-peering).
DOMAIN-RESOURCE-NAME : nom complet de la ressource de votre domaine Microsoft AD géré au format projects/PROJECT-ID/locations/global/domains/DOMAIN-NAME.
SHARED-VPC-NAME : nom complet de la ressource de votre réseau VPC partagé, au format projects/PROJECT-ID/global/networks/NETWORK-NAME.
VPC-RESOURCE-PROJECT-ID: ID du projet hôte qui héberge le VPC partagé.
Répertoriez à nouveau les mises en paire de domaines pour vérifier leur état. Exécutez la commande de gcloud CLI suivante :
gcloud active-directory peerings list --project=PROJECT_ID
Remplacez PROJECT_ID par l'ID du projet de service utilisé pour créer votre ressource de peering de domaine.
Il renvoie l'état CONNECTED à partir des projets hôte et de service.
Configurer l'instance Cloud SQL (SQL Server)
Créez l'instance Cloud SQL (SQL Server) dans le projet de service avec l'adresse IP privée activée, puis sélectionnez le réseau du VPC partagé. Pour en savoir plus, consultez la section Créer une instance avec l'authentification Windows.
Une fois l'association de domaines terminée, modifiez la configuration de Cloud SQL (SQL Server) pour qu'elle utilise votre domaine Microsoft AD géré pour l'authentification. Exécutez la commande de gcloud CLI suivante :
INSTANCE-NAME: nom de votre instance Cloud SQL dans le projet de service.
DOMAIN-RESOURCE-NAME: nom complet de la ressource de votre domaine Microsoft AD géré que vous souhaitez utiliser pour l'authentification. Format du nom de ressource complet : projects/PROJECT-ID/locations/global/domains/DOMAIN-NAME.
SQL Server est maintenant configuré avec l'authentification Windows activée.
Tester la configuration
Créez une VM Windows ou Linux dans le projet de service. Lorsque vous créez la VM, sélectionnez le VPC partagé et le sous-réseau partagé dans le VPC partagé avec ce projet de service.
Associez la VM à un domaine. Pour en savoir plus sur l'association d'une VM Windows à un domaine, consultez Associer une VM Windows à un domaine.
Vous avez appairé un domaine Microsoft AD géré avec l'hôte du VPC partagé et créé SQL Server sur le VPC partagé. Avec ce peering de domaine, l'authentification Windows dans plusieurs projets est activée pour SQL Server.
Dans le scénario ci-dessus, Microsoft AD géré et SQL Server se trouvent dans des projets de service différents, mais il est également possible de les configurer dans le même projet de service.
Vous pouvez également placer le domaine Microsoft AD géré dans le projet hôte. Dans ce cas, le réseau VPC partagé doit être ajouté en tant que réseau autorisé au domaine Microsoft AD géré. Pour en savoir plus, consultez la section Ajouter des réseaux autorisés à un domaine existant.
Dans tous ces scénarios, grâce au peering avec le VPC partagé, le domaine est disponible pour le ou les projets de service associés au VPC partagé.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[],[],null,["# Deploy Managed Microsoft AD with cross-project access using domain peering\n\nThis topic shows you how to configure domain peering between Managed Service for Microsoft Active Directory (Managed Microsoft AD) and Shared VPC. This allows you to make Managed Microsoft AD available to service projects attached to Shared VPC.\n\nOverview\n--------\n\n[Domain peering](/managed-microsoft-ad/docs/domain-peering) in Managed Microsoft AD creates a domain peering resource in each domain resource and VPC resource projects. Managed Microsoft AD domain can be made available to all the projects attached to the Shared VPC by creating a domain peering between Managed Microsoft AD and Shared VPC. For example, you can authenticate and login to SQL Server using Managed Microsoft AD domain, where SQL Server and Managed Microsoft AD are in different service projects that are attached to the Shared VPC.\n\nBefore you begin\n----------------\n\nBefore you begin, do the following:\n\n1. In the Google Cloud console, on the project selector page, select or create three Google Cloud projects. They are called host and service projects. The host project is where the Shared VPC is enabled. Managed Microsoft AD domain and Cloud SQL instances must reside in different service projects. The VMs could reside in one of the service projects.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n2. Enable billing for your Cloud project(s). For more information, see [Check if billing is enabled on a project](/billing/docs/how-to/modify-project#confirm_billing_is_enabled_on_a_project).\n\n3. Enable Shared VPC on the host project. For more information, see [Enable a host project](/vpc/docs/provisioning-shared-vpc#enable-shared-vpc-host).\n\n4. Attach the service project(s) to the Shared VPC network. Each of the projects need to have Compute Engine API enabled. For the purpose of this example, we recommend creating separate subnets in the Shared VPC. While attaching the project, choose the appropriate subnet for each of the project(s). For more information, see [Attach service projects](/vpc/docs/provisioning-shared-vpc#create-shared).\n\n5. [Create a Managed Microsoft AD domain](/managed-microsoft-ad/docs/create-domain) in the service project. The VPC network authorized while creating the Managed Microsoft AD domain is independent of the Shared VPC networks. To create a Managed Microsoft AD domain without an authorized network, use the gcloud CLI command.\n\nConfigure domain peering\n------------------------\n\n1. Create domain peering from the service project having the domain resource to the Shared VPC network. For more information about domain peering, see [Configure domain peering](/managed-microsoft-ad/docs/quickstart-domain-peering#configure_domain_peering).\n\n ```\n gcloud active-directory peerings create PEERING-RESOURCE-NAME \\\n --domain=DOMAIN-RESOURCE-NAME \\\n --authorized-network=SHARED-VPC-NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePEERING-RESOURCE-NAME\u003c/var\u003e: A name for your domain peering resource (such as `my-domain-peering`).\n - \u003cvar translate=\"no\"\u003eDOMAIN-RESOURCE-NAME\u003c/var\u003e: The [full resource name](/iam/docs/full-resource-names) of your Managed Microsoft AD domain, in the form of: `projects/`\u003cvar translate=\"no\"\u003ePROJECT-ID\u003c/var\u003e`/locations/global/domains/`\u003cvar translate=\"no\"\u003eDOMAIN-NAME\u003c/var\u003e.\n - \u003cvar translate=\"no\"\u003eSHARED-VPC-NAME\u003c/var\u003e: The [full resource name](/iam/docs/full-resource-names) of your Shared VPC network, in the form of: `projects/`\u003cvar translate=\"no\"\u003ePROJECT-ID\u003c/var\u003e`/global/networks/`\u003cvar translate=\"no\"\u003eNETWORK-NAME\u003c/var\u003e.\n2. List the domain peerings to verify the state. Run the following gcloud CLI command:\n\n ```\n gcloud active-directory peerings list --project=PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the project ID of the service project that is used to create your domain peering resource.\n\n It returns the state as `DISCONNECTED`.\n3. Create the reverse domain peering from the host project.\n\n ```\n gcloud active-directory peerings create PEERING-RESOURCE-NAME \\\n --domain=DOMAIN-RESOURCE-NAME \\\n --authorized-network=SHARED-VPC-NAME \\\n --project=VPC-RESOURCE-PROJECT-ID\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePEERING-RESOURCE-NAME\u003c/var\u003e: A name for your domain peering resource (such as `my-domain-peering`).\n - \u003cvar translate=\"no\"\u003eDOMAIN-RESOURCE-NAME\u003c/var\u003e: The [full resource name](/iam/docs/full-resource-names) of your Managed Microsoft AD domain, in the form of: `projects/`\u003cvar translate=\"no\"\u003ePROJECT-ID\u003c/var\u003e`/locations/global/domains/`\u003cvar translate=\"no\"\u003eDOMAIN-NAME\u003c/var\u003e.\n - \u003cvar translate=\"no\"\u003eSHARED-VPC-NAME\u003c/var\u003e: The [full resource name](/iam/docs/full-resource-names) of your Shared VPC network, in the form of: `projects/`\u003cvar translate=\"no\"\u003ePROJECT-ID\u003c/var\u003e`/global/networks/`\u003cvar translate=\"no\"\u003eNETWORK-NAME\u003c/var\u003e.\n - \u003cvar translate=\"no\"\u003eVPC-RESOURCE-PROJECT-ID\u003c/var\u003e: The project ID of the host project that is hosting the Shared VPC.\n4. List the domain peerings again to verify the state. Run the following gcloud CLI command:\n\n ```\n gcloud active-directory peerings list --project=PROJECT_ID\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the project ID of the service project that is used to create your domain peering resource.\n\n It returns the state as `CONNECTED` from both the host and service projects.\n\nConfigure the Cloud SQL (SQL Server) instance\n---------------------------------------------\n\n1. Create the Cloud SQL (SQL Server) instance in the service project with Private IP enabled and select the network of the Shared VPC. For more information, see [Create an instance with Windows Authentication](/sql/docs/sqlserver/configure-ad#creating-an-instance-with-windows-authentication).\n\n2. After the domain peering is complete, modify the Cloud SQL (SQL Server) configuration to use your Managed Microsoft AD domain for authentication. Run the following gcloud CLI command:\n\n ```\n gcloud beta sql instances patch INSTANCE-NAME \\\n --active-directory-domain=DOMAIN-RESOURCE-NAME\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eINSTANCE-NAME\u003c/var\u003e: The name of your Cloud SQL instance in the service project.\n - \u003cvar translate=\"no\"\u003eDOMAIN-RESOURCE-NAME\u003c/var\u003e: The [full resource name](/iam/docs/full-resource-names) of your Managed Microsoft AD domain that you want to use for authentication. Full resource name format: `projects/`\u003cvar translate=\"no\"\u003ePROJECT-ID\u003c/var\u003e`/locations/global/domains/`\u003cvar translate=\"no\"\u003eDOMAIN-NAME\u003c/var\u003e.\n\n For more information, see [Enable cross-project Windows authentication](/sql/docs/sqlserver/configure-ad#enable-cross-project-auth).\n\nThe SQL Server is now configured with Windows authentication enabled.\n\nTest the setup\n--------------\n\n1. Create a Windows or Linux VM in the service project. While creating the VM, select the Shared VPC and the subnet which is shared in the Shared VPC with this service project.\n2. Join the VM to a domain. For more information about joining a Windows VM to a domain, see [Join a Windows VM to a domain](/managed-microsoft-ad/docs/quickstart-domain-join-windows).\n3. Create a SQL Server login based on a Windows user or group. For more information, see [Connect to an instance with a user](/sql/docs/sqlserver/configure-ad#connecting-to-an-instance-with-a-user).\n4. Connect using the SQL Server's instance DNS name. For more information, see Step 2 in [Connect to an instance with a user](/sql/docs/sqlserver/configure-ad#connecting-to-an-instance-with-a-user).\n\nSummary\n-------\n\nYou have domain peered a Managed Microsoft AD domain with the Shared VPC host and created SQL Server on the Shared VPC. With this domain peering, cross-project Windows authentication is enabled for SQL Server.\n\nWhile in the above scenario Managed Microsoft AD and SQL Server are in different service projects, configuring them in the same service project is also supported.\n\nAlternatively, you can also have the Managed Microsoft AD domain in the host project. In this case, Shared VPC needs to be added as an authorized network to the Managed Microsoft AD domain. For more information, see [Adding authorized networks to an existing domain](/managed-microsoft-ad/docs/managing-authorized-networks#adding_authorized_networks_to_an_existing_domain).\n\nIn all these scenarios through peering with Shared VPC, the domain is available to the service project(s) attached to the Shared VPC."]]