Skip to content

Commit d59be72

Browse files
authored
DOCSP-46542 OIDC Support (#186)
* DOCSP-46542 OIDC Support
1 parent bd9248d commit d59be72

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

source/authentication.txt

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
.. _tools-authentication:
2+
3+
=============================
4+
Database Tools Authentication
5+
=============================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 1
13+
:class: singlecol
14+
15+
Starting in 100.11.0, you can use database tools with
16+
:atlas:`Atlas Workload Identity Federation </workload-oidc>` to
17+
authenticate connections to MongoDB running on Microsoft Azure
18+
and Google Cloud Platform.
19+
20+
Examples
21+
--------
22+
23+
This section shows database tools examples that use Workload Identity
24+
Federation.
25+
26+
In the connection string, set :urioption:`authMechanism` to
27+
``MONGODB-OIDC`` and set :urioption:`authMechanismProperties` as
28+
needed:
29+
30+
- For Microsoft Azure, set ``authMechanismProperties`` to
31+
``ENVIRONMENT:azure,TOKEN_RESOURCE:<audience>``. Note:
32+
Omit ``TOKEN_RESOURCE`` if using Microsoft Azure Kubernetes
33+
Service (AKS).
34+
- For Google Cloud Platform, set ``authMechanismProperties`` to
35+
``ENVIRONMENT:gcp,TOKEN_RESOURCE:<audience>``.
36+
37+
Replace ``<audience>`` with the application or service that the access
38+
token is intended for. For more details, see :ref:`Identity Provider
39+
Fields <oidcidentityproviders-fields>`.
40+
41+
Connect to MongoDB using Microsoft Azure Instance Metadata Service
42+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43+
44+
The following ``mongodump`` example connects to MongoDB using
45+
Microsoft Azure Instance Metadata Service (IMDS):
46+
47+
.. code-block:: shell
48+
49+
mongodump --uri "mongodb://mongodb.example.com:20017/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure,TOKEN_RESOURCE:https://www.example.com" \
50+
--username admin
51+
52+
Connect to MongoDB using Microsoft Azure Kubernetes Service
53+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54+
55+
To connect to MongoDB using Microsoft Azure Kubernetes Service,
56+
define these environment variables:
57+
58+
.. list-table::
59+
:header-rows: 1
60+
:widths: 30 70
61+
62+
* - Environment Variable
63+
- Description
64+
65+
* - ``AZURE_TENANT_ID``
66+
- Azure tenant identifier.
67+
68+
* - ``AZURE_APP_CLIENT_ID``
69+
- Azure application client identifier.
70+
71+
* - ``AZURE_CLIENT_ID``
72+
- Azure client identifier of the managed identity to authenticate
73+
with.
74+
75+
* - ``AZURE_FEDERATED_TOKEN_FILE``
76+
- Azure federated token file path.
77+
78+
For details about Azure and the variables, see the Microsoft Azure
79+
documentation.
80+
81+
The following ``mongodump`` example defines the environment variables
82+
and connects to MongoDB:
83+
84+
.. code-block:: shell
85+
86+
AZURE_TENANT_ID=08206ab8-16a0-406d-85e4-2f15f5620fac \
87+
AZURE_APP_CLIENT_ID=b6c835da-e536-425b-9405-64bc471e245b \
88+
AZURE_CLIENT_ID=f176d4eb-7dcd-4f66-bccf-aaa316ee61fd \
89+
AZURE_FEDERATED_TOKEN_FILE=/var/run/secrets/azure/tokens/azure-identity-token \
90+
mongodump --uri "mongodb://mongodb.example.com:20017/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure" \
91+
--username "admin"
92+
93+
``TOKEN_RESOURCE`` isn't required for this example.
94+
95+
Connect to MongoDB on Google Cloud Platform
96+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97+
98+
The following ``mongodump`` example connects to MongoDB on
99+
Google Cloud Platform:
100+
101+
.. code-block:: shell
102+
103+
mongodump --uri "mongodb://mongodb.example.com:20017/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:gcp,TOKEN_RESOURCE:https://www.example.com" \
104+
--username "admin"
105+
106+
No environment variables are required for Google Cloud Platform.
107+

source/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,5 @@ Further Reading
154154
mongofiles </mongofiles>
155155
Installation </installation>
156156
Logs </logs>
157+
Authentication </authentication>
157158
100.10.0 Changelogs </release-notes/database-tools-changelog>

0 commit comments

Comments
 (0)