【问题标题】:Azure Certificate Validation Failed By Token Handler令牌处理程序导致 Azure 证书验证失败
【发布时间】:2017-06-25 06:53:17
【问题描述】:

我在 Azure 门户中为我的 API 项目安装了两个客户端证书。我已经设置了配置选项来启用它们,并且可以验证它们都可以在 CurrentUser 'My' 商店中找到。我现在的问题是其中一个验证失败。在我的本地机器上,我在 LocalMachine 的 Trusted People 商店中安装了这个证书。我可以使用 Azure 来完成这项工作吗?

证书的位置是问题还是可能与证书本身有关?

**注意这是应用服务,不是云服务

【问题讨论】:

  • 嗨!你设法解决了这个问题吗?我也有同样的问题。
  • @kord 请检查以下解决方案。希望对你有帮助

标签: api azure web certificate x509certificate


【解决方案1】:

您可以检查的内容很少,在 Azure 中检查应用设置是否已添加证书。它位于 Azure 应用的 SSL 部分。

另一种解决方法是在您配置令牌身份验证的位置,您可以设置此设置。 例如就我而言,我收到了 X509 证书错误。 我在我的项目中添加了这段代码。

        System.IdentityModel.Configuration.IdentityConfiguration config = new System.IdentityModel.Configuration.IdentityConfiguration();
        config.CertificateValidator = X509CertificateValidator.None;
        config.CertificateValidationMode = X509CertificateValidationMode.None;

基本上关闭您的验证。大多数情况下,发生的情况是您的本地计算机作为 IT 操作人员安装的所有证书,但这些证书不在 Azure 上。

您也可以在此处查看一些参考。 Microsoft Certificate Reference

【讨论】:

  • 谢谢阿克谢。我已添加证书。当我导航到“cert:\CurrentUser\My”时,我可以在 Azure 的 Kudu Powershell 控制台中看到它。问题是我在“cert:\CurrentUser\TrustedPeople”中需要它,因为我使用它与本地 WCF 服务(PeerTrust 模式)进行通信。到目前为止,在 Azure App Service 世界中,我还没有找到将它安装在 TrustedPeople 商店中的方法......
  • 你可以通过 KUDU 把它放在需要的文件夹中,或者你可以修改你的 csproj 文件
  • 我认为你不能为 Azure 应用服务做到这一点。 PS Cert:\CurrentUser> $destStore = Get-Item cert:\CurrentUser\TrustedPeople PS Cert:\CurrentUser> $destStore.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite) Exception calling "Open" with "1" argument(s): "Access is denied."
猜你喜欢
  • 1970-01-01
  • 2021-09-10
  • 1970-01-01
  • 2017-05-19
  • 1970-01-01
  • 2012-03-15
  • 2019-04-17
  • 2022-10-19
  • 2011-12-20
相关资源
最近更新 更多