I have created service principal but there is no proper code or I don't know exactly how to create SSL certificate for Azure Service Principal in Python.. Please help me on this
Asked
Active
Viewed 180 times
1 Answers
0
You can use Microsoft Graph REST API endpoint servicePrincipal: addKey to create a certificate for the service principal provided you have the service principal id in Graph Context.
In your python script you can perform a HTTP request like below.
import requests
payload = {
"keyCredential": {
"type": "AsymmetricX509Cert",
"usage": "Verify",
"key": "MIIDYDCCAki..."
},
"passwordCredential": null,
"proof":"eyJ0eXAiOiJ..."
}
r = requests.post(r'https://graph.microsoft.com/v1.0/servicePrincipals/{id}/addKey', data=payload)
I have not tested the request in python but should work as it is just REST api.

Danstan
- 1,501
- 1
- 13
- 20
-
How to generate key in Key credential? @Danstan – Todd Oct 19 '21 at 12:34