You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For :class:`PublicClientApplication`, you use `None` here.
240
+
234
241
For :class:`ConfidentialClientApplication`,
235
-
it can be a string containing client secret,
236
-
or an X509 certificate container in this form::
242
+
it supports many different input formats for different scenarios.
237
243
238
-
{
239
-
"private_key": "...-----BEGIN PRIVATE KEY-----... in PEM format",
240
-
"thumbprint": "A1B2C3D4E5F6...",
241
-
"public_certificate": "...-----BEGIN CERTIFICATE-----... (Optional. See below.)",
242
-
"passphrase": "Passphrase if the private_key is encrypted (Optional. Added in version 1.6.0)",
243
-
}
244
+
.. admonition:: Support using a client secret.
244
245
245
-
MSAL Python requires a "private_key" in PEM format.
246
-
If your cert is in a PKCS12 (.pfx) format, you can also
247
-
`convert it to PEM and get the thumbprint <https://github.com/Azure/azure-sdk-for-python/blob/07d10639d7e47f4852eaeb74aef5d569db499d6e/sdk/identity/azure-identity/azure/identity/_credentials/certificate.py#L101-L123>`_.
246
+
Just feed in a string, such as ``"your client secret"``.
248
247
249
-
The thumbprint is available in your app's registration in Azure Portal.
250
-
Alternatively, you can `calculate the thumbprint <https://github.com/Azure/azure-sdk-for-python/blob/07d10639d7e47f4852eaeb74aef5d569db499d6e/sdk/identity/azure-identity/azure/identity/_credentials/certificate.py#L94-L97>`_.
248
+
.. admonition:: Support using a certificate in X.509 (.pem) format
251
249
252
-
*Added in version 0.5.0*:
253
-
public_certificate (optional) is public key certificate
254
-
which will be sent through 'x5c' JWT header only for
255
-
subject name and issuer authentication to support cert auto rolls.
256
-
257
-
Per `specs <https://tools.ietf.org/html/rfc7515#section-4.1.6>`_,
258
-
"the certificate containing
259
-
the public key corresponding to the key used to digitally sign the
260
-
JWS MUST be the first certificate. This MAY be followed by
261
-
additional certificates, with each subsequent certificate being the
262
-
one used to certify the previous one."
263
-
However, your certificate's issuer may use a different order.
264
-
So, if your attempt ends up with an error AADSTS700027 -
265
-
"The provided signature value did not match the expected signature value",
266
-
you may try use only the leaf cert (in PEM/str format) instead.
267
-
268
-
*Added in version 1.13.0*:
269
-
It can also be a completely pre-signed assertion that you've assembled yourself.
270
-
Simply pass a container containing only the key "client_assertion", like this::
250
+
Feed in a dict in this form::
271
251
272
-
{
273
-
"client_assertion": "...a JWT with claims aud, exp, iss, jti, nbf, and sub..."
274
-
}
252
+
{
253
+
"private_key": "...-----BEGIN PRIVATE KEY-----... in PEM format",
254
+
"thumbprint": "A1B2C3D4E5F6...",
255
+
"passphrase": "Passphrase if the private_key is encrypted (Optional. Added in version 1.6.0)",
256
+
}
257
+
258
+
MSAL Python requires a "private_key" in PEM format.
259
+
If your cert is in PKCS12 (.pfx) format,
260
+
you can convert it to X.509 (.pem) format,
261
+
by ``openssl pkcs12 -in file.pfx -out file.pem -nodes``.
262
+
263
+
The thumbprint is available in your app's registration in Azure Portal.
264
+
Alternatively, you can `calculate the thumbprint <https://github.com/Azure/azure-sdk-for-python/blob/07d10639d7e47f4852eaeb74aef5d569db499d6e/sdk/identity/azure-identity/azure/identity/_credentials/certificate.py#L94-L97>`_.
265
+
266
+
.. admonition:: Support Subject Name/Issuer Auth with a cert in .pem
# id came from https://docs.msidlab.com/accounts/confidentialclient.html
464
464
client_id=os.getenv(env_client_id)
465
465
# Cert came from https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/asset/Microsoft_Azure_KeyVault/Certificate/https://msidlabs.vault.azure.net/certificates/LabVaultAccessCert
0 commit comments