With Create a self-signed public certificate to authenticate your application | Microsoft Learn created certificate.
$certname = "{certificateName}" ## Replace {certificateName}
$cert = New-SelfSignedCertificate -Subject "CN=$certname" -CertStoreLocation "Cert:\CurrentUser\My" -KeyExportPolicy Exportable -KeySpec Signature -KeyLength 2048 -KeyAlgorithm RSA -HashAlgorithm SHA256
Export-Certificate -Cert $cert -FilePath "C:\Users\admin\Desktop\$certname.cer" ## Specify your preferred location
Any way to add this certificate to Entra Id app registration programatically using Python SDK?
To upload certificate to the Azure AD application, you can try the below:
Generate the thumbprint and read the certificate key:
And use the below Microsoft Graph API query:
The certificate uploaded successfully like below:
To do the same in Python, make use of below code:
Reference:
Add a certificate to an app or service principal using Microsoft Graph - Microsoft Graph | Microsoft