Azure active directory 无法在Azure AD应用程序集成期间添加证书

Azure active directory 无法在Azure AD应用程序集成期间添加证书,azure-active-directory,certificate,x509,pem,Azure Active Directory,Certificate,X509,Pem,我在尝试为我正在集成的Azure AD应用程序添加证书(文件名为cert.pem)时遇到以下错误: 无法添加证书。错误详细信息:上载具有以下文件类型之一的证书(公钥):.cer、.pem、.crt 我确信,即使文件类型正确(.pem),文件的结构和内容也不正确,但我不知道如何修复它。正如您所说,文件的内容不正确。您可以使用PowerShell with创建用于测试目的的证书。试着参考。确保您以管理员帐户的身份打开PowerShell $pwd = "<password>&q

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

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


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

正如您所说,文件的内容不正确。您可以使用PowerShell with创建用于测试目的的证书。试着参考。确保您以管理员帐户的身份打开PowerShell

$pwd = "<password>"
$currentDate = Get-Date
$endDate = $currentDate.AddYears(10) #10 years is nice and long
$thumb = (New-SelfSignedCertificate -DnsName "techmikael.com" -CertStoreLocation "cert:\LocalMachine\My"  -KeyExportPolicy Exportable -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider" -NotAfter $endDate).Thumbprint
$pwd = ConvertTo-SecureString -String $pwd -Force -AsPlainText
Export-PfxCertificate -cert "cert:\localmachine\my\$thumb" -FilePath .\techmikael.pfx -Password $pwd
$path = (Get-Item -Path ".\").FullName
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate("$path\techmikael.pfx", $pwd)
$keyValue = [System.Convert]::ToBase64String($cert.GetRawCertData())
$pwd=“”
$currentDate=获取日期
$endDate=$currentDate.AddYears(10)#10年又长又好
$thumb=(新的自签名证书-DnsName“techmikael.com”-CertStoreLocation“cert:\LocalMachine\My”-KeyExportPolicy Exportable-Provider“Microsoft增强RSA和AES加密提供程序”-不晚于$endDate)。指纹
$pwd=converttosecurestring-String$pwd-Force-AsPlainText
导出PfxCertificate-cert“cert:\localmachine\my\$thumb”-文件路径。\techmikael.pfx-密码$pwd
$path=(获取项-路径“\”).FullName
$cert=新对象系统.Security.Cryptography.X509Certificates.X509Certificate($path\techmikael.pfx“,$pwd)
$keyValue=[System.Convert]::ToBase64String($cert.GetRawCertData())

如果我的回复有帮助,请将其作为答案接受(单击回复旁边的标记选项,将其从灰显切换为填写),请参阅