使用 Customer Engagement (on-premises) 和 SharePoint Online 配置基于服务器的身份验证

本主题介绍如何在 Dynamics 365 Customer Engagement (on-premises) 和 Microsoft SharePoint Online 之间配置基于服务器的身份验证。

所需权限

Customer Engagement (on-premises)

  • 系统管理员安全角色。 这是在 Customer Engagement (on-premises) 中运行“启用基于服务器的 SharePoint 集成”向导所必需的。

  • 如果您将自签名证书用于评估目的,则必须在运行 Microsoft Dynamics 365 Server 的计算机上拥有本地管理员组成员资格。

SharePoint Online

  • Office 365全局管理员成员。 这是管理级人员访问 Office 365 订阅和运行 Microsoft AzurePowerShell cmdlet 所必需的

使用 Customer Engagement (on-premises) 和 SharePoint Online 设置基于服务器的身份验证

按照提供的步骤顺序设置 Customer Engagement (on-premises) 与 SharePoint Online。

重要提示

  • 必须完全按所述步骤顺序来完成。 如果未完成任务(如返回错误消息的 Windows PowerShell 命令),您必须解决问题,然后继续执行下一命令、任务或步骤。

  • 启用基于服务器的 SharePoint 集成后,您不能恢复到之前的基于客户的授权方法。 这意味着,配置基于服务器的 SharePoint 集成的 Customer Engagement (on-premises) 组织后,不能使用 Microsoft Dynamics CRM 列表组件。

  • 连接相同 Customer Engagement (on-premises) 部署中的多个 Customer Engagement (on-premises) 组织到多个 SharePoint Online 网站,SharePoint Online 网站必须位于同一 Microsoft Office 365 租户。

验证必备组件

在配置 Customer Engagement (on-premises) 和 SharePoint Online 以进行基于服务器的身份验证之前,必须满足下列必备条件:

  • 必须已经配置 Customer Engagement (on-premises) 部署并且可通过 Internet 获得部署。 更多信息:为 Dynamics 365 for Customer Engagement (on-premises) 配置 IFD

  • Microsoft Dynamics 365 Hybrid Connector。 Microsoft Dynamics 365 Hybrid Connector 是可以将基于服务器的身份验证用于 Dynamics 365 (on-premises) 和 SharePoint Online 的免费连接器。 详细信息:Microsoft Dynamics CRM 混合连接器

  • 由受信任的证书颁发机构颁发并将用于 Customer Engagement (on-premises) 和 SharePoint Online 之间的身份验证的 x509 数字证书。 如果您在评估基于服务器的身份验证,则可以使用自签名证书。

以下软件功能要求运行本主题介绍的 Windows PowerShell cmdlet。

重要提示

在编写这个模块时,IT 专家 RTW 版的 Microsoft Online Services 登录助手是存在问题。 在解决问题前,建议您使用 Beta 版本。 详细信息:Microsoft Azure 论坛:不能安装适用于 Windows PowerShell 的 Azure Active Directory 模块。未安装 MOSSIA

设置基于服务器的身份验证

  1. 在运行部署工具服务器角色的 Dynamics 365 Server 上,启动适用于 Windows PowerShell 的 Azure Active Directory 模块。

    重要提示

    运行以下 PowerShell 命令的计算机必须具有“验证必备组件”中之前所述的必备软件功能。

  2. 准备证书。

    $CertificateScriptWithCommand = “.\CertificateReconfiguration.ps1 -certificateFile c:\Personalcertfile.pfx -password personal_certfile_password -updateCrm -certificateType S2STokenIssuer -serviceAccount contoso\CRMWebApplicationService -storeFindType FindBySubjectDistinguishedName”
    
     Invoke-Expression -command $CertificateScriptWithCommand
    
  3. 准备 PowerShell 会话。

    以下 cmdlet 使计算机接收远程命令和添加 Office 365 模块到 PowerShell 会话。

    Enable-PSRemoting -force
    New-PSSession
    Import-Module MSOnline -force
    Import-Module MSOnlineExt -force
    
  4. 连接到 Office 365。

    在运行 Connect-MsolService 命令时,必须提供一个有效的 Microsoft 帐户,其中包含 SharePoint Online 许可证所需的 Office 365 全局管理员成员资格。

    有关此处所列 Azure Active Directory 命令的每个 MSOnline 模块的详细信息,请参阅 MSOnline

    $msolcred = get-credential
    connect-msolservice -credential $msolcred
    
  5. 设置证书。

    $Certificate = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
    $Certificate.Import(“c:\Personalcertfile.cer”)
    $CERCertificateBin = $Certificate.GetRawCertData()
    $CredentialValue = [System.Convert]::ToBase64String($CERCertificateBin)
    
  6. 在 SharePoint 中设置 Azure Active Directory 服务主体名称 (SPN)。

    *.contoso.com 替换为 Microsoft Dynamics 365 Server 所在域的名称。

    $RootDomain = “*.contoso.com”
    $CRMAppId = "00000007-0000-0000-c000-000000000000" 
    New-MsolServicePrincipalCredential -AppPrincipalId $CRMAppId -Type asymmetric -Usage Verify -Value $CredentialValue
    $CRM = Get-MsolServicePrincipal -AppPrincipalId $CRMAppId
    $ServicePrincipalName = $CRM.ServicePrincipalNames
    $ServicePrincipalName.Remove("$CRMAppId/$RootDomain")
    $ServicePrincipalName.Add("$CRMAppId/$RootDomain")
    Set-MsolServicePrincipal -AppPrincipalId $CRMAppId -ServicePrincipalNames $ServicePrincipalName
    
  7. 配置 Microsoft Dynamics 365 Server 以便与 SharePoint 进行基于服务器的身份验证。

    Add-PSSnapin Microsoft.Crm.PowerShell 
    $setting = New-Object "Microsoft.Xrm.Sdk.Deployment.ConfigurationEntity"
    $setting.LogicalName = "ServerSettings"
    $setting.Attributes = New-Object "Microsoft.Xrm.Sdk.Deployment.AttributeCollection"
    $attribute1 = New-Object "System.Collections.Generic.KeyValuePair[String, Object]" ("S2SDefaultAuthorizationServerPrincipalId", "00000001-0000-0000-c000-000000000000")
    $setting.Attributes.Add($attribute1)
    $attribute2 = New-Object "System.Collections.Generic.KeyValuePair[String, Object]" ("S2SDefaultAuthorizationServerMetadataUrl", "https://accounts.accesscontrol.windows.net/metadata/json/1")
    $setting.Attributes.Add($attribute2)
    Set-CrmAdvancedSetting -Entity $setting
    

运行“启用基于服务器的 SharePoint 集成向导”

  1. 在 Customer Engagement (on-premises) 中,转至文档管理

  2. 在文档管理区域中,选择启用基于服务器的 SharePoint 集成

  3. 查看信息,然后选择下一步

  4. 对于 SharePoint 网站,选择联机,然后选择下一步

  5. 在“准备网站”阶段,输入以下信息。

    • 输入 SharePoint Online 网站集 URL,如 https://contoso.sharepoint.com/sites/salesteam

    • 输入租户 ID。 详细信息:获取 SharePoint online 租户 ID

  6. 选择下一步

  7. 验证网站节出现。 如果所有网站都确定为有效,选择启用。 如果一个或多个站点确定无效,请参阅基于服务器的身份验证疑难解答

获取 SharePoint Online 租户 ID

使用 PowerShell

  1. 在适用于 Windows PowerShell shell Azure Active Directory 模块中,运行下列命令。

    $CRMContextId = (Get-MsolCompanyInformation).ObjectID
    $CRMContextId
    
  2. 将显示的 GUID 复制到剪贴板。

使用网站设置

  1. 登录到您将用于 Customer Engagement (on-premises) 文档管理的 SharePoint 网站集。

  2. 转到网站设置>网站应用权限

    租户 ID 显示在应用程序标识符下方,@ 符号的右侧。 复制并仅粘贴此 GUID。 不要将标识符的任何部分粘贴到 @ 左侧。

排查“启用基于服务器的身份验证”向导验证问题

身份验证失败。 当用于服务器到服务器身份验证的证书缺失或无效时,返回此错误。