Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette rubrique explique comment configurer MongoDB pour l'intégration avec le service géré pour Microsoft Active Directory. La procédure suivante est validée pour MongoDB Enterprise dans les versions 4.0 et 4.2.
Commencez par déployer MongoDB sur Google Cloud. Pour assurer la compatibilité avec Active Directory, veillez à installer une version de MongoDB compatible avec l'authentification LDAP, telle que MongoDB Enterprise Edition. Vous pouvez installer MongoDB sur une instance Compute Engine ou vous pouvez déployer MongoDB sur Google Kubernetes Engine.
Accédez au répertoire ./mongo-k8s-sidecar/example/StatefulSet/ :
Ouvrir mongo-statefulset.yaml
Remplacez image: mongo par image: path to gcr.
Configurer l'authentification
Ensuite, configurez l'authentification. Le service Microsoft AD géré peut être utilisé comme backend LDAP pour l'authentification. Vous pouvez choisir LDAP ou Kerberos.
Pour configurer l'authentification, utilisez les valeurs de configuration afin de réaliser l'une des procédures d'installation suivantes :
Utilisez les valeurs suivantes pour configurer l'authentification :
security.ldap.server : utilisez le nom de domaine complet que vous avez fourni pour le domaine lors de la configuration.
security.ldap.userToDNMapping : utilisez le nom du domaine fourni dans ldapQuery.
Exemple : ldapQuery: "DC=cloudad,DC=gke,DC=com??sub?(userPrincipalName={0})"
security.ldap.server.authz : utilisez le nom du domaine fourni dans queryTemplate.
Exemple : queryTemplate: "DC=cloudad,DC=gke,DC=com??sub?(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={USER}))"
security.ldap.transportSecurity : définissez la valeur sur none pour désactiver TLS/SSL.
Dans le service Microsoft AD géré, les utilisateurs sont créés sous Cloud OU. Vous devez utiliser le nom distinctif pour les ressources et les groupes créés sous Cloud OU.
Par exemple, pour l'utilisateur dba, vous utiliseriez le nom distinctif "CN=dba,OU=Cloud,DC=cloudad,DC=gke,DC=com".
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,["# Connect MongoDB\n\nThis topic shows you how to configure MongoDB for integration with\nManaged Service for Microsoft Active Directory. The following procedure is verified for MongoDB Enterprise,\nversions 4.0 and 4.2.\n\nBefore you begin\n----------------\n\nBefore configuring MongoDB,\n[create a Managed Microsoft AD domain](/managed-microsoft-ad/docs/quickstart-create-domain).\n\nDeploying MongoDB\n-----------------\n\nFirst, deploy MongoDB to Google Cloud. For compatibility with Active Directory,\nbe sure to install a version of MongoDB that supports LDAP authentication, such\nas MongoDB Enterprise Edition. You can install MongoDB on a Compute Engine\ninstance or you can deploy MongoDB on Google Kubernetes Engine.\n\n### On a Compute Engine instance\n\nTo install MongoDB as a standalone package on a Compute Engine instance,\n[complete the steps in the MongoDB Enterprise installation](https://docs.mongodb.com/manual/administration/install-enterprise/).\n\n### On a Google Kubernetes Engine container\n\nTo deploy MongoDB on Google Kubernetes Engine container, complete the following steps:\n\n1. Complete the [Running a MongoDB Database in Kubernetes with StatefulSets Codelab](https://codelabs.developers.google.com/codelabs/cloud-mongodb-statefulset/index.html?index=..%2F..index#0).\n2. Go to the `./mongo-k8s-sidecar/example/StatefulSet/` directory.\n3. Open `mongo-statefulset.yaml`\n4. Replace `image: mongo` with `image: path to gcr`\n\nConfiguring Authentication\n--------------------------\n\nNext, configure authentication. Managed Microsoft AD can be used as an LDAP\nbackend for authentication. You can choose LDAP or Kerberos.\n\nTo configure authentication, use the [configuration values](#values) to complete\none of the following setup procedures:\n\n- To set up authentication using LDAP, [complete the MongoDB LDAP tutorial](https://docs.mongodb.com/v4.0/tutorial/authenticate-nativeldap-activedirectory/).\n- To set up authentication using Kerberos, [complete the MongoDB Kerberos tutorial](https://docs.mongodb.com/v4.0/tutorial/kerberos-auth-activedirectory-authz/).\n\n### Authentication configuration values\n\nUse the following values to configure authentication:\n\n- `security.ldap.server`: Use the FQDN you provided for the domain during setup.\n- `security.ldap.userToDNMapping`: Use the domain name of domain provided in `ldapQuery`.\n - Example: `ldapQuery: \"DC=cloudad,DC=gke,DC=com??sub?(userPrincipalName={0})\"`\n- `security.ldap.server.authz`: Use domain name of domain provided in `queryTemplate`.\n - Example: `queryTemplate: \"DC=cloudad,DC=gke,DC=com??sub?(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={USER}))\"`\n- `security.ldap.transportSecurity`: Set to `none` to disable TLS/SSL.\n\nIn Managed Microsoft AD, users are created under `Cloud OU`. You should use\nthe distinguished name for the resources and groups created under `Cloud OU`.\nFor example, for user `dba`, you would use the distinguished name,\n`\"CN=dba,OU=Cloud,DC=cloudad,DC=gke,DC=com\"`."]]