首页 > 解决方案 > Azure 功能:在证书中找不到具有此指纹的证书

问题描述

我正在创建连接到执行 PnP 命令的 azure 函数。我已经创建了文档中提到的证书。我总是得到Cannot find certificate with this thumbprint in the certificate store.Exception :Type

为什么会发生此错误?有什么设置需要修改吗? 在此处输入图像描述

标签: azurefunctionpowershellsharepoint

解决方案


关于这个问题,请参考以下步骤

  1. 创建自签名证书
New-PnPAzureCertificate -OutPfx pnp.pfx -OutCert pnp.cer
  1. 创建 Azure AD 应用程序

  2. 配置权限

    Office 365 SharePoint Online(应用程序权限)

    • Sites.FullControl.All

    • TermStore.ReadWrite.All

    • User.ReadWriteAll

  3. 将您的客户端证书(cer 文件)上传到 AD 应用程序 在此处输入图像描述

  4. 创建函数

  5. 将 pfx 文件上传到 Azure 函数

az webapp config ssl upload --certificate-file "e:\cert\pnp.pfx"  --name "<function app name>" --resource-group ""  --certificate-password "" --query thumbprint --output tsv

  1. 配置函数以允许函数读取证书
az functionapp config appsettings set --name <app-name> --resource-group <resource-group-name> --settings WEBSITE_LOAD_CERTIFICATES=<comma-separated-certificate-thumbprints>

8 功能码

Connect-PnPOnline -Tenant <>.onmicrosoft.com -ClientId <the appid of the ad application> -Thumbprint <comma-separated-certificate-thumbprints> -Url https://<>.sharepoint.com

在此处输入图像描述


推荐阅读