Connect-ExchangeOnline -CertificateThumbPrint "abcdefghijjklmnopqrstuvwxyz" -AppID "2x1xxe5b-4x2e-3x4t-xxre-fxxxb34xxxxx66" -Organization "tenant.onmicrosoft.com"
and this happend:
[System.Management.Automation.RuntimeException] One or more errors occurred.
[Microsoft.Identity.Client.MsalClientException] Could not use the certificate for signing. See inner exception for details. Possible cause: this may be a known issue with apps build against .NET Desktop 4.6 or lower. Either target a higher version of .NET desktop - 4.6.1 and above, or use a different certificate type (non-CNG) or sign your own assertion as described at aka.ms/msal-net-signed-assertion.
[System.Security.Cryptography.CryptographicException] Invalid provider type specified.
You're gonna need OpenSSL for this:
Import the newly created .pfx into certlm.msc and try connection to Exchange Online Management PowerShell with the new certificate.
[System.Management.Automation.RuntimeException] One or more errors occurred.
[Microsoft.Identity.Client.MsalClientException] Could not use the certificate for signing. See inner exception for details. Possible cause: this may be a known issue with apps build against .NET Desktop 4.6 or lower. Either target a higher version of .NET desktop - 4.6.1 and above, or use a different certificate type (non-CNG) or sign your own assertion as described at aka.ms/msal-net-signed-assertion.
[System.Security.Cryptography.CryptographicException] Invalid provider type specified.
I still don't know way this happend, but I do know that this is the solution.
(If you're reading this and can explain why this happens, drop a comment.)
Convert the certificate's private key from CNG format to RSA.
- Using certlm.msc export the current certificate, or if the original pfx file still exist use that.
- Extract the public keys, including certificate chain:
- Extract the private key:
- Convert the key to RSA format:
- Merge into a new pfx file:
Import the newly created .pfx into certlm.msc and try connection to Exchange Online Management PowerShell with the new certificate.
The thumbprint in your script stays the same.