@@ -28,9 +28,15 @@ In the :ref:`connection string <connections-connection-options>`, set
28
28
:urioption:`authMechanismProperties` as needed:
29
29
30
30
- For Microsoft Azure, set ``authMechanismProperties`` to
31
- ``ENVIRONMENT:azure``
31
+ ``ENVIRONMENT:azure,TOKEN_RESOURCE:<audience>``. Note:
32
+ Omit ``TOKEN_RESOURCE`` if using Microsoft Azure Kubernetes
33
+ Service (AKS).
32
34
- For Google Cloud Platform, set ``authMechanismProperties`` to
33
- ``ENVIRONMENT:gcp``
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>`.
34
40
35
41
For details about connection string options, see
36
42
:ref:`connection-string-auth-options`.
@@ -45,16 +51,16 @@ Microsoft Azure Instance Metadata Service (IMDS):
45
51
46
52
./bin/mongosync \
47
53
--logPath /var/log/mongosync \
48
- --cluster0 "mongodb://clusterOne01.fancyCorp.com:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure" \
49
- --cluster1 "mongodb://clusterTwo01.fancyCorp.com:20020,clusterTwo02.fancyCorp.com:20020,clusterTwo03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure"
54
+ --cluster0 "mongodb://clusterOne01.fancyCorp.com:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure,TOKEN_RESOURCE:https://www.example.com " \
55
+ --cluster1 "mongodb://clusterTwo01.fancyCorp.com:20020,clusterTwo02.fancyCorp.com:20020,clusterTwo03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure,TOKEN_RESOURCE:https://www.example.com "
50
56
51
57
.. _c2c-authentication-azure-managed-identities-example:
52
58
53
- Connect to MongoDB Clusters Using Microsoft Azure Managed Identities
59
+ Connect to MongoDB Clusters Using Microsoft Azure Kubernetes Service
54
60
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55
61
56
- To connect to MongoDB clusters using Microsoft Azure Managed Identities
57
- and federated authentication, define these environment variables:
62
+ To connect to MongoDB clusters using Microsoft Azure Kubernetes Service,
63
+ define these environment variables:
58
64
59
65
.. list-table::
60
66
:header-rows: 1
@@ -70,7 +76,8 @@ and federated authentication, define these environment variables:
70
76
- Azure application client identifier.
71
77
72
78
* - ``AZURE_CLIENT_ID``
73
- - Azure client identifier.
79
+ - Azure client identifier of the managed identity to authenticate
80
+ with.
74
81
75
82
* - ``AZURE_FEDERATED_TOKEN_FILE``
76
83
- Azure federated token file path.
@@ -79,7 +86,7 @@ For details about Azure and the variables, see the Microsoft Azure
79
86
documentation.
80
87
81
88
The following ``mongosync`` example defines the environment variables
82
- and connects to MongoDB clusters in Microsoft Azure :
89
+ and connects to MongoDB clusters:
83
90
84
91
.. code-block:: shell
85
92
@@ -92,6 +99,8 @@ and connects to MongoDB clusters in Microsoft Azure:
92
99
--cluster0 "mongodb://clusterOne01.fancyCorp.com:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure" \
93
100
--cluster1 "mongodb://clusterTwo01.fancyCorp.com:20020,clusterTwo02.fancyCorp.com:20020,clusterTwo03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:azure"
94
101
102
+ ``TOKEN_RESOURCE`` isn't required for this example.
103
+
95
104
Connect to MongoDB Clusters in Google Cloud Platform
96
105
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97
106
@@ -102,8 +111,8 @@ Google Cloud Platform:
102
111
103
112
./bin/mongosync \
104
113
--logPath /var/log/mongosync \
105
- --cluster0 "mongodb://clusterOne01.fancyCorp.com:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:gcp" \
106
- --cluster1 "mongodb://clusterTwo01.fancyCorp.com:20020,clusterTwo02.fancyCorp.com:20020,clusterTwo03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:gcp"
114
+ --cluster0 "mongodb://clusterOne01.fancyCorp.com:20020,clusterOne02.fancyCorp.com:20020,clusterOne03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:gcp,TOKEN_RESOURCE:https://www.example.com " \
115
+ --cluster1 "mongodb://clusterTwo01.fancyCorp.com:20020,clusterTwo02.fancyCorp.com:20020,clusterTwo03.fancyCorp.com:20020/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:gcp,TOKEN_RESOURCE:https://www.example.com "
107
116
108
117
No environment variables are required for Google Cloud Platform.
109
118
0 commit comments