无法在Azure AD应用集成期间添加证书



我在尝试为我正在集成的Azure AD应用程序添加证书时遇到以下错误,该证书的文件名为cert.pem:

添加证书失败。错误详细信息:上载具有以下文件类型之一的证书(公钥(:.cer、.pem、.crt

我确信,即使文件类型是正确的(.pem(,文件的结构和内容也是不正确的,但我不知道如何修复它。

正如您所说,文件的内容不正确。您可以使用带有New-SelfSignedCertificate的PowerShell创建用于测试目的的证书。请尝试参考此处。请确保以管理员帐户的身份打开PowerShell。

$pwd = "<password>"
$currentDate = Get-Date
$endDate = $currentDate.AddYears(10) #10 years is nice and long
$thumb = (New-SelfSignedCertificate -DnsName "techmikael.com" -CertStoreLocation "cert:LocalMachineMy"  -KeyExportPolicy Exportable -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" -NotAfter $endDate).Thumbprint
$pwd = ConvertTo-SecureString -String $pwd -Force -AsPlainText
Export-PfxCertificate -cert "cert:localmachinemy$thumb" -FilePath .techmikael.pfx -Password $pwd
$path = (Get-Item -Path ".").FullName
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate("$pathtechmikael.pfx", $pwd)
$keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData())

最新更新