Bereitstellung von Managed Microsoft AD mit projektübergreifendem Zugriff über Domain-Peering
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
In diesem Thema erfahren Sie, wie Sie das Domain-Peering zwischen Managed Service for Microsoft Active Directory (Managed Microsoft AD) und der freigegebenen VPC konfigurieren. So können Sie Managed Microsoft AD für Dienstprojekte verfügbar machen, die an eine freigegebene VPC angehängt sind.
Übersicht
Beim Domain-Peering in Managed Microsoft AD wird in jeder Domainressource und in jedem VPC-Ressourcenprojekt eine Domain-Peering-Ressource erstellt. Die Managed Microsoft AD-Domain kann für alle an die freigegebene VPC angehängten Projekte verfügbar gemacht werden, indem ein Domain-Peering zwischen Managed Microsoft AD und der freigegebenen VPC erstellt wird. Sie können sich beispielsweise mit einer Managed Microsoft AD-Domain authentifizieren und bei SQL Server anmelden, wobei sich SQL Server und Managed Microsoft AD in verschiedenen Dienstprojekten befinden, die an die freigegebene VPC angehängt sind.
Hinweise
Führen Sie zuerst folgende Schritte aus:
Wählen Sie in der Google Cloud Console auf der Seite der Projektauswahl drei Google Cloud Projekte aus oder erstellen Sie sie. Sie werden als Host- und Dienstprojekte bezeichnet. Im Hostprojekt ist die freigegebene VPC aktiviert. Die Managed Microsoft AD-Domain und die Cloud SQL-Instanzen müssen sich in verschiedenen Dienstprojekten befinden. Die VMs können sich in einem der Dienstprojekte befinden.
Aktivieren Sie die freigegebene VPC im Hostprojekt. Weitere Informationen finden Sie unter Hostprojekt aktivieren.
Hängen Sie die Dienstprojekte an das freigegebene VPC-Netzwerk an. Für jedes Projekt muss die Compute Engine API aktiviert sein. Für dieses Beispiel empfehlen wir, separate Subnetze im freigegebenen VPC zu erstellen. Wählen Sie beim Anhängen des Projekts das entsprechende Subnetz für jedes Projekt aus. Weitere Informationen finden Sie unter Dienstprojekte anhängen.
Erstellen Sie eine Managed Microsoft AD-Domain im Dienstprojekt. Das VPC-Netzwerk, das beim Erstellen der Managed Microsoft AD-Domain autorisiert wurde, ist unabhängig von den freigegebenen VPC-Netzwerken. Verwenden Sie den Befehl der gcloud-Befehlszeile, um eine verwaltete Microsoft AD-Domain ohne autorisiertes Netzwerk zu erstellen.
Domain-Peering konfigurieren
Erstellen Sie ein Domain-Peering vom Dienstprojekt mit der Domainressource zum freigegebenen VPC-Netzwerk. Weitere Informationen zum Domain-Peering finden Sie unter Domain-Peering konfigurieren.
PEERING-RESOURCE-NAME: Ein Name für Ihre Domain-Peering-Ressource (z. B. my-domain-peering).
DOMAIN-RESOURCE-NAME: Der vollständige Ressourcenname Ihrer verwalteten Microsoft AD-Domain in Form von projects/PROJECT-ID/locations/global/domains/DOMAIN-NAME.
SHARED-VPC-NAME: Der vollständige Ressourcenname Ihres freigegebenen VPC-Netzwerks in der Form: projects/PROJECT-ID/global/networks/NETWORK-NAME.
Listen Sie die Domain-Peerings auf, um den Status zu prüfen. Führen Sie den folgenden gcloud CLI-Befehl aus:
gcloud active-directory peerings list --project=PROJECT_ID
Ersetzen Sie PROJECT_ID durch die Projekt-ID des Dienstprojekts, mit dem die Domain-Peering-Ressource erstellt wird.
Der Status wird als DISCONNECTED zurückgegeben.
Erstellen Sie das Reverse-Domain-Peering aus dem Hostprojekt.
PEERING-RESOURCE-NAME: Ein Name für Ihre Domain-Peering-Ressource (z. B. my-domain-peering).
DOMAIN-RESOURCE-NAME: Der vollständige Ressourcenname Ihrer verwalteten Microsoft AD-Domain in Form von projects/PROJECT-ID/locations/global/domains/DOMAIN-NAME.
SHARED-VPC-NAME: Der vollständige Ressourcenname Ihres freigegebenen VPC-Netzwerks in der Form: projects/PROJECT-ID/global/networks/NETWORK-NAME.
VPC-RESOURCE-PROJECT-ID: Die Projekt-ID des Hostprojekts, in dem die freigegebene VPC gehostet wird.
Listen Sie die Domain-Peerings noch einmal auf, um den Status zu überprüfen. Führen Sie den folgenden gcloud CLI-Befehl aus:
gcloud active-directory peerings list --project=PROJECT_ID
Ersetzen Sie PROJECT_ID durch die Projekt-ID des Dienstprojekts, mit dem die Domain-Peering-Ressource erstellt wird.
Der Status wird sowohl vom Host- als auch vom Dienstprojekt als CONNECTED zurückgegeben.
Cloud SQL (SQL Server)-Instanz konfigurieren
Erstellen Sie die Cloud SQL-Instanz (SQL Server) im Dienstprojekt mit aktivierter privater IP-Adresse und wählen Sie das Netzwerk des freigegebenen VPC aus. Weitere Informationen finden Sie unter Instanz mit Windows-Authentifizierung erstellen.
Nachdem das Domain-Peering abgeschlossen ist, ändern Sie die Cloud SQL-Konfiguration (SQL Server), damit Ihre Managed Microsoft AD-Domain für die Authentifizierung verwendet wird. Führen Sie den folgenden gcloud CLI-Befehl aus:
INSTANCE-NAME: Der Name Ihrer Cloud SQL-Instanz im Dienstprojekt.
DOMAIN-RESOURCE-NAME: Der vollständige Ressourcenname Ihrer Managed Microsoft AD-Domain, die Sie für die Authentifizierung verwenden möchten. Format des vollständigen Ressourcennamens:
projects/PROJECT-ID/locations/global/domains/DOMAIN-NAME.
Der SQL Server ist jetzt mit aktivierter Windows-Authentifizierung konfiguriert.
Einrichtung testen
Erstellen Sie im Dienstprojekt eine Windows- oder Linux-VM. Wählen Sie beim Erstellen der VM die freigegebene VPC und das Subnetz aus, das in der freigegebenen VPC für dieses Dienstprojekt freigegeben ist.
Verbinden Sie die VM mit einer Domain. Weitere Informationen zum Verbinden einer Windows-VM mit einer Domain finden Sie unter Windows-VM mit einer Domain verbinden.
Sie haben eine Managed Microsoft AD-Domain per Domain-Peering mit dem Host der freigegebenen VPC verbunden und SQL Server in der freigegebenen VPC erstellt. Durch dieses Domain-Peering wird die projektübergreifende Windows-Authentifizierung für SQL Server aktiviert.
Im obigen Szenario befinden sich Managed Microsoft AD und SQL Server in verschiedenen Dienstprojekten. Es wird aber auch unterstützt, sie im selben Dienstprojekt zu konfigurieren.
Alternativ können Sie die Managed Microsoft AD-Domain auch im Hostprojekt platzieren. In diesem Fall muss das freigegebene VPC der verwalteten Microsoft AD-Domain als autorisiertes Netzwerk hinzugefügt werden. Weitere Informationen finden Sie unter Autorisierte Netzwerke zu einer bestehenden Domain hinzufügen.
In all diesen Szenarien ist die Domain über das Peering mit der freigegebenen VPC für die an die freigegebene VPC angehängten Dienstprojekte verfügbar.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-11 (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."]]