不怕你配置不會,就怕你看的資料不對!MIM 與 SharePoint 同步完全配置指南。


    為了更好的同步 User Profile,在 SharePoint 2010 中首次引入了 FIM (ForeFront Identity Manager) 用於編輯 User Profile 的同期方式。在 SharePoint 2013 中,FIM 繼承了 SharePoint 2010 的可以編輯同期的特點,並加入了一些 SharePoint GUI 上無法實現的功能。與 SharePoint 2010 & 2013 可以直接在界面上使用 SharePoint User Profile Synchronization 的方式進行與 AD 或其他數據源同步不同,SharePoint 2016 只能在 GUI 上選擇 AD Import Synchronization 這種同步方式。而 AD Import 這種同步方式功能有限,而且也很難實現一些復雜的環境的 User Profile 同步需求。這就讓 FIM 的升級產品 —— MIM(Microsoft Identity Manager) 成為使用 User Profile 必備的同步工具。

    在這篇教程中,我們主要就 MIM 環境的構築和最簡單的 Windows 認證的 User Profile 同步來講解使用 MIM 如何完成 SharePoint 2016 和 AD 的同步。由於 MIM 本身僅有英語版本,且MIM 和非英語Windows Server 以及 SharePoint Server 兼容性不好,本篇教程將完全以英語環境進行。

    在進行本教程提供的配置方法前,我們首先要進行一系列的操作,來保證 SharePoint Server 2016(后簡稱 SPS 16) 和 Microsoft Identity Manager 2016(后簡稱 MIM) 能夠正確安裝和使用。

執行前准備操作:

1)保證 SPS 16 的正確安裝,並開啟 User Profile Service (后簡稱 UPS)。使用 Configuration Wizards 的自動配置建立的 User Profile Service Application(后簡稱 UPSA)即可。

2) 如果 MIM 使用特殊的服務器來進行構築,請做如下操作來保證 MIM 能夠正確安裝:

2.1)在 AD 上追加 MIMSync 和 MIMMA 兩個 User。並將這兩個 User 添加進 Domain Admin Group 中。

2.2)在 AD 上使用如下 PowerShell Commands 來添加 MIM 需要的 Group。

1 import-module activedirectory
2 New-ADGroup –name MIMSyncAdmins –GroupCategory Security –GroupScope Global –SamAccountName MIMSyncAdmins
3 New-ADGroup –name MIMSyncOperators –GroupCategory Security –GroupScope Global –SamAccountName MIMSyncOperators
4 New-ADGroup –name MIMSyncJoiners –GroupCategory Security –GroupScope Global –SamAccountName MIMSyncJoiners
5 New-ADGroup –name MIMSyncBrowse –GroupCategory Security –GroupScope Global –SamAccountName MIMSyncBrowse
6 New-ADGroup –name MIMSyncPasswordReset –GroupCategory Security –GroupScope Global –SamAccountName MIMSyncPasswordReset
7 Add-ADGroupMember -identity MIMSyncAdmins -Members Administrator

2.3)在要構築 MIM 的 Windows Server 上,做如下操作以保證 MIM 可以正確安裝。

2.3.1)使用管理員打開 PowerShell 命令行工具,並輸入如下 Command 更新組策略。

1 gpupdate /force /target:computer

 

2.3.2)在 Windows Server 中安裝如下服務器角色。

- IIS Web Server

- Application Server(Windows Server 2016 無需安裝)

- Remote Server Administration Tools

- Role Administration Tools

-AD DS and AD LDS Tools

- Active Directory module for Windows PowerShell

- .NET Framework 3.5

- .NET Framework 4.5

完成安裝后,再次以管理員模式打開 PowerShell 命令行工具,輸入如下 Command 安裝組件的子組件。

1 import-module ServerManager
2 
3 Install-WindowsFeature Web-WebServer, Net-Framework-Features,rsat-ad-powershell,Web-Mgmt-Tools,Application-Server,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer –includeallsubfeature -restart

 

注意:可能需要為 .NET Framework 3.5 功能的源文件指定其他位置。 這些功能通常在安裝 Windows Server 時並不存在,但在操作系統安裝磁盤源文件夾上的並行 (SxS) 文件夾中可見,例如,“d:\Sources\SxS*”。如果使用了這種模式請將 Command 修改如下:

1 import-module ServerManager
2 
3 Install-WindowsFeature Web-WebServer, Net-Framework-Features,rsat-ad-powershell,Web-Mgmt-Tools,Application-Server,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer –includeallsubfeature -restart -source d:\sources\SxS

 

執行完這步操作后,Windows Server 將會自動重新啟動。安裝和重新啟動均會消耗較多時間,耐心等待系統啟動完畢后再執行后續操作。

2.3.3)配置 MIM Server 需要的本地組策略。

- 啟動 Run 程序,並在窗口中輸入 “secpol.msc”,點擊確定打開 Local Security Policy 控制程序。

- 為剛才在域中添加的 User “MIMSync” 和 “MIMMA” 添加到 Local Policies > User Rights Assignment 組策略中的用戶中。

      1. Deny log on as a batch job
      2. Deny log on locally
      3. Deny access to this computer from the network
      4. Log on as a service

 

- 關閉 Local Security Policy 控制程序。

2.3.4)用管理員權限啟動 PowerShell 命令行工具,並使用如下Commands 修改 MIM Server 的 IIS Web Server 的認證模式。

1 iisreset /STOP
2 C:\Windows\System32\inetsrv\appcmd.exe unlock config /section:windowsAuthentication -commit:apphost
3 iisreset /START

 

2.3.5)使用管理員打開 PowerShell 命令行工具,並輸入如下 Command 再次更新組策略。

gpupdate /force /target:computer

 

3)在 SQL Server 2016 上需要進行的操作:

3.1)如果 MIM Server 不是安裝在 SPS 16 所在的 Server 上,我們就需要為 MIM Server 安裝 SQL Server 2008 R2 SP1 以上版本的 SQL Server Native Client 來保證當前 Server 能夠正確訪問 SQL Server。

由於本教程使用的 SQL Server 版本為 2016,所以建議安裝Microsoft SQL Server 2012 Native Client,下載地址如下:

下載完畢后,請按照如下手順進行安裝:

https://docs.microsoft.com/en-us/sql/relational-databases/native-client/applications/installing-sql-server-native-client

3.2)打開 SQL Servere Management Studio,為域管理員 administrator 以及 MIMSync 和 MIMMA 添加數據庫 public,dbcreator 和 sysadmin 角色保證用戶可以創建和訪問數據庫。

 

 

3.3)打開Sql Server Configuration Manager,確認 SQL Full-text Fillter Daemon Launcher[在 SQL Server 安裝中就需要安裝] 和 SQL Server Agent 處於 Running 狀態。如果不是,請手動啟動。

 

 

4)[可選]如果有條件,可以配置一個 Exchange Server,如果沒有 Exchange Server,MIM 會每 1 小時打出一條無法找到 Exchange Server 的警報 Event Log。

安裝 MIM Server Synchronization Service:

1)下載 MIM Server 2016 SP1 評估版:

https://www.microsoft.com/en-us/evalcenter/evaluate-microsoft-identity-manager-2016

輸入個人信息后可以下載評估版的 MIM Server。

2)在 Windows Server 中打開下載的 ISO 文件,導航到 [Synchronzation Service] 文件夾后,雙擊 [setup.exe] 啟動安裝程序。

3)在歡迎頁面點擊 [Next]。

 

 

4)在 Review the license 頁面選擇 agree 並點擊 [Next].

5) 在 Custome Setup 頁面可以設置安裝位置,文件並不大,建議直接點擊 [Next].

6) 在 Synchronization Service database configuration 頁面,選擇:

- The SQL Server is located on: <SQL Server Computer Name or IP Address>

- The SQL Server instance is: <SQL Server Instance Name>

如圖:

 

 

並點擊 [Next]。

7)在 Synchronization Service 設置頁面中,輸入如下信息:

- Service account : MIMSync

- Password : <User Password>

- Service Accouont Domain or local computer name : <Domain Name>

 

 

並點擊 [Next]。

8)在 Synchronization Serivce Group Setting 頁面,輸入如下信息:

- Administrator : MIMSyncAdmins

- Operator : MIMSyncOperators

- Joiner : MIMSyncJoiners

- Connector Browse : MIMSyncBrowse

- WMI Password Management : MIMSyncPasswordReset

 

 

並點擊 [Next]。

9)在 security settings 配置頁面, 勾選 Enable firewall rules for inbound RPC communications, 然后點擊 [Next]。

10)點擊 [Install] 開始安裝。

11)在安裝過程中,會要求你備份你的設置數據和 key 等數據,你會看到下圖的警告,點擊 [OK],保存一個文件並繼續安裝。

 

 

12)安裝完成后,點擊[Finish],退出安裝工具。

13) 重新啟動 Server 或者 Sign out 后再次 Sign in,完成組成員和管理員的配置。

14)打開 Service 管理頁面,確認 Forefront Identity Manager Sycnchronization Service 的狀態為 running,如果不是,你的安裝就失敗了。請檢查 Event log 找到失敗的原因並嘗試重新安裝和啟動這個服務。

 

 

配置 MIM 環境的更新:

1)訪問下方頁面,下載 MIM 最新更新 build 4.4.1642.0.

https://www.microsoft.com/en-us/download/details.aspx?id=55794&751be11f-ede8-5a0c-058c-2ee190a24fa6=True

注意 : 在點擊 [Download] 之后,僅需勾選 “4.4.1642.0\FIMSyncService_x64_KB4021562.msp” 下載即可。其他組件無需下載。

2)將下載的文件移動到 C:\ 下,右鍵單擊該文件,選擇 Propertise。在 tag 中選擇 Security 選項卡。點擊屏幕中部的 [Edit], 再彈出的權限配置頁面中,為 Users 組配置 Full control 的 Allow 權限。

 

 

3)以管理員模式啟動 CMD 命令行程序,輸入 cd\ 讓目標路徑退回到 C:\> 下。輸入文件名 "FIMSyncService_x64_KB4021562.msp" 並按回車鍵啟動更新安裝程序。

4)一直點擊下一步完成安裝。完成安裝后需要重新啟動計算機。

安裝 SharePoint 同步用的組件:

1) 訪問如下頁面,下載 SharePoint 和 MIM 同期的必備組件:

https://download.microsoft.com/download/3/7/A/37A820C9-378E-49E9-9F81-2E7D8536AD42/SharepointConnector.msi

2)雙擊該文件,一路 [Next] 安裝。

3)安裝完畢后,訪問 C:\Program Files\Microsoft Forefront Identity Manager\2010\Synchronization Service\Extensions 路徑確認 Microsoft.IdentityManagement.Connector.Sharepoint.dll 和 Microsoft.IdentityManagement.ManagedLogger.dll 是否存在。

 

 

4)使用記事本打開 C:\Program Files\Microsoft Forefront Identity Manager\2010\Synchronization Service\Bin 路徑下的 miiserver.exe.config 文件(打開前需要為 Users 組配置 Full control 權限),並修改代碼如下:

修改前:

 1   <runtime>
 2     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
 3       <dependentAssembly>
 4         <assemblyIdentity name="Microsoft.MetadirectoryServicesEx" publicKeyToken="31bf3856ad364e35" />
 5         <bindingRedirect oldVersion="3.3.0.0-4.1.3.0" newVersion="4.1.4.0" />
 6      </dependentAssembly>
 7       <probing privatePath="Assemblies" />
 8     </assemblyBinding>
 9   </runtime>

 

 

修改后:

  

 1 <runtime>
 2     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
 3       <dependentAssembly>
 4         <assemblyIdentity name="Microsoft.MetadirectoryServicesEx" publicKeyToken="31bf3856ad364e35" />
 5         <bindingRedirect oldVersion="3.3.0.0-4.1.3.0" newVersion="4.1.4.0" /> 
 6       </dependentAssembly> 
 7       <dependentAssembly>
 8         <assemblyIdentity name="Microsoft.IdentityManagement.ManagedLogger" publicKeyToken="31bf3856ad364e35" />
 9         <bindingRedirect oldVersion="3.3.0.0-4.3.0.0" newVersion="4.3.2430.0" /> 
10       </dependentAssembly>
11       <probing privatePath="Assemblies" />
12     </assemblyBinding>
13   </runtime>

 

保存該文件,並在 Services Management 中重啟 Forefront Identity Manager Sycnchronization Service 。

 

使用 MIM 同步 AD 用戶屬性到 SharePoint:

1)需要在 SharePoint Server 端做的設置:

1.1) 打開 UPSA 的管理頁面,並點擊 [Configure Synchronization Settings]

 

 

1.2) 在 [Configure Synchronization Settings] 頁面的 [Synchronization Options] 選項中,選擇 [Enable External Identity Manager],並點擊 [OK]。

 

 

1.3)在 [Manage Service Application] 頁面中,點擊 [User Profile Service Application] 的空白處,並在 [SERVICEC APPLICATIONS] Tag 上點擊 [Administrators]。

 

 

為管理員賬戶配置 Full Control 權限后,點擊 [OK] 保存設置。

2)下載 AD to SharePoint User Profile Synchronization 解決方案。

https://github.com/SharePoint/PnP-Tools

 

 

3)解壓縮下載文件,並將 %file location%PnP-Tools/Solutions/UserProfile.MIMSync/下的所有文件拷貝到 MIM Server 的任意目錄下,如 C:\1。

 

 

4)管理員模式打開 PowerShell 命令行工具,執行下列 Commands 來完成 SharePoint Server 和 AD DC 間的同期 Management Agent 的創建。

Import-Module C:\1\SharePointSync.psm1 -Force
Install-SharePointSyncConfiguration `
  -Path C:\1`
  -ForestDnsName ocsi.lab `
  -ForestCredential (Get-Credential ocsi\MIMMA) `
  -OrganizationalUnit 'cn=Users,dc=ocsi,dc=lab' `
  -SharePointUrl http://SPS:10086 `
  -SharePointCredential (Get-Credential OCSI\SharePointFarmAdmin) `
  -Verbose

 

你會看到執行過程中有一些 ERROR ,但是這些 ERROR 是可以無視的。

 

 

5)啟動 Synchronization Serivce Manager, 並導航到 Management Agent 選項卡,你可以看到自動創建出了兩個 Management Agents —— “ADMA” 和 “SPMA”。(忽略我圖上的 ADMA11 和 SPMA1)。

 

 

6)雙擊打開 ADMA, 在 Properties 對話框中,選擇左側的 [Configure Directory Partitions]。

 

 

 

7)在“CN=Configuration,DC=ocsi,DC=lab”和 “DC=ocsi,DC=lab”的 [Credentials] 選項中,均選擇 [Altemate credentials for this directory partition],並點擊 [Set Credentials...] 輸入 AD administrator 的用戶名,密碼和域后,點擊 [OK] 保存設定。

 

 

8)以管理員權限啟動 PowerShell 命令行工具,並執行如下 Command 完成 AD to SharePoint 的 User Profile 同期操作。

1 Import-Module C:\1\SharePointSync.psm1 -Force
2 Start-SharePointSync -Confirm:$false

 

你將看到如下輸出結果,並可以在 SharePoint 的 UPSA 管理頁面中確認到成功同期的 SharePoint User Profile。

 

 

 

遇到問題的解決方案:

與 SharePoint 有診斷 log 不同,MIM 是沒有單獨的 log 存在的,所以我們可以使用 Event Viewer 來確認 MIM 在安裝和同步過程中出現的各種問題。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM