了解 SharePoint Server 2013 中的多重租用

 

**適用版本:**SharePoint Server 2013, SharePoint Server 2013 Enterprise

**上次修改主題的時間:**2017-09-06

**摘要:**了解 SharePoint Server 2013 中的多重租用功能以及與多重租用相關的基礎元件和服務。

本文說明 SharePoint Server 2013 中多重租用的相關元件和服務,也提供結構、安全、作業和管理指引,協助服務提供者了解 SharePoint Server 2013 中的多重租用,來規劃、設計、建置以及管理多承租人 SharePoint Server 2013 主控平台。

注意

商務用 OneDrive 與 Yammer 整合不適用於內部部署的多重租用或分割服務應用程式。

開始之前

SharePoint 支援您使用常見瀏覽器的協助工具功能,來管理部署及存取網站。如需詳細資訊,請參閱<SharePoint 2013 的協助工具>。

SharePoint Server 2013 中的多重租用簡介

什麼是多重租用?

介紹 SharePoint Server 2013 中的多重租用功能之前,您應該了解多重租用的一般概念和其相關特性;如此可協助您進行規劃、設計、操作和管理多承租人 SharePoint Server 2013 主控平台的適當決策。

多重租用指的是管理和分割網站以及共用服務或軟體之資料的能力,以容納多個承租人。這與執行多個服務執行個體或設定不同硬體相反。在 Microsoft 產品和技術中,服務的多重租用會建立伺服器陣列資源最大化的主控環境。了解主控環境之前,請務必先了解服務架構。

啟用 SharePoint Server 2013 中多重租用的重要元件和服務

本節說明啟用 SharePoint Server 2013 中多重租用的重要元件和服務。

Web 應用程式

SharePoint 2013 Web 應用程式包含一個 Internet Information Services (IIS) 網站,做為所建立網站集合之管理和安全的邏輯單位。每個 Web 應用程式都是以使用唯一或共用應用程式集區的不同 IIS 網站來呈現。建立 Web 應用程式時,也可以建立內容資料庫,以及定義用來連線至資料庫的驗證方法。

主機命名型網站集合

主機命名型網站集合可讓您指派專屬 DNS 名稱給網站集合。例如,您可以將它們的位址寫成 http://TeamA.contoso.com and http://TeamB.fabrikam.com。這可讓您在同一個 Web 應用程式中,部署許多使用專屬 DNS 名稱的網站。它也可讓服務提供者將環境延伸到許多客戶。如果不使用主機命名型網站集合,SharePoint Web 應用程式將包含許多具有相同主機名稱 (DNS 名稱) 的路徑型網站集合。例如,小組 A 具有位址為共用 https://contoso.com/sites/teamA 的網站集合,而小組 B 具有位址為 https://fabrikam.com/sites/teamB 的網站集合。

主機命名型網站集合基本上是延伸多重租用環境的唯一方法,並提供所使用 URL 命名空間的最大彈性。如果搭配使用路徑型網站與多重租用,則很快就會達到受管理路徑的軟體界限。

如需如何規劃 SharePoint Server 2013 之主機命名型網站集合的其他資訊,請參閱SharePoint Server 中已指定主機的網站集合架構與部署

服務群組 (Proxy 群組)

「服務群組」也稱為「Proxy 群組」,是一組選取以供 Web 應用程式使用的服務應用程式。

除非在建立服務應用程式時指定另一個群組,否則預設群組中預設會包括所有服務應用程式。您隨時都可以新增和移除預設群組中的服務應用程式。建立 Web 應用程式時,您可以選取預設群組,也可以建立一組自訂的服務。只選取想要 Web 應用程式使用的服務應用程式,即可建立一組自訂的服務。

自訂群組不可在多個 Web 應用程式中重複使用。每次在建立 Web 應用程式時選取 [自訂],只會選取供所建立 Web 應用程式使用的服務。

服務 Proxy

建立服務應用程式時,同時會建立服務應用程式的 Proxy。Proxy 是將 Web 應用程式連線至服務應用程式的虛擬實體。Proxy 會列在 SharePoint 管理中心網站 的 [管理服務應用程式] 頁面中。

如果您使用 管理中心 或 SharePoint 2016 產品設定精靈 建立服務應用程式,則會自動建立 Proxy。如果您使用 Microsoft PowerShell 建立服務應用程式,則一律不會自動建立 Proxy,因此必須使用 Microsoft PowerShell 予以建立。

部分 Proxy 可能包括可變更的設定。例如,如果 Web 應用程式連線至 Managed Metadata 服務的多個執行個體,則您必須指出連線至主要服務應用程式 (其主控公司分類) 的 Proxy。一般而言,使用多重租用時,這些設定會移到承租人層級設定。

服務應用程式

服務應用程式會以邏輯方式呈現指定服務,以及其安全和管理設定 (定義其作業行為)。範例包括 Managed Metadata 和 User Profiles。不同的服務應用程式會以不同的方式進行實作,而這會影響多承租人方案的設計。

若要判定 SharePoint Server 2013 中可用的服務應用程式清單以及其在 SharePoint 版本 (含多重租用功能) 中的可用性,請參閱 給主機服務提供者的 SharePoint Server 2013 一般指引中的服務和功能一節。

功能套件和授權

SharePoint 中的功能套件是將一組網站範圍或 Web 範圍功能群組在一起的方式。SharePoint 功能在群組之後,就可以與網站訂閱 (即承租人) 相關聯。該網站訂閱 (承租人) 中的所有網站集合都只能使用屬於功能套件一部分的網站範圍或 Web 範圍功能。此功能可讓服務提供者根據不同組的功能來提供分層服務方案。

在 SharePoint Server 2013 中,已新增一項功能,以根據使用者指派不同的 SharePoint 授權。它也開啟執行階段的 SharePoint 授權檢查。此功能提供額外的彈性,讓服務提供者在簡化的部署模型中建置不同的服務方案。在舊版 SharePoint 中,服務提供者必須為每個 SharePoint 版本建置不同的 SharePoint 部署模型。如需 SharePoint 功能的其他資訊,請參閱下列文章中的內部部署方案中的 SharePoint feature availability across on-premises solutions 小節:<SharePoint 線上服務說明>。

資訊版權管理

SharePoint Server 2013 中的資訊版權管理整合新增多重租用支援,其啟用管理承租人層級資訊版權管理設定的能力。

架構設計考量

本節說明架構多重租用 SharePoint Server 2013 環境的各種考量。如本文件前面所述,多重租用在架構和設計 SharePoint Server 2013 環境時需要考慮一些唯一特性。您需要根據需求來衡量那些因素,以便制定適當決策。

了解 SharePoint Server 2013 的界限及限制

了解 SharePoint Server 2013 的軟體界限和限制,可協助您做出正確的決策,以選取多重租用 SharePoint 環境的適當架構。如需套用至 SharePoint Server 2013 多重租用環境之重要內容資料庫和網站集合界限和限制的其他資訊,請參閱內容資料庫限制網站集合限制

共用伺服器陣列與專用伺服器陣列

使用共用伺服器陣列在單一 Web 應用程式上主控多承租人網站集合,所提供的延展性優於每個承租人都使用專用 Web 應用程式。

只有在需要滿足隔離需求時,每個客戶才需要使用專用 Web 應用程式和應用程式集區。

不允許在網站中部署完全信任程式碼。

不允許影響共用資源 (例如 web.config 檔案) 的自訂。

使用主機命名型網站集合,在整個 Web 應用程式中建立多個根層級網站集合 (網域命名型網站)。

一個 Web 應用程式與多個 Web 應用程式

針對需要進行影響資源之自訂的承租人,請使用專用 Web 應用程式,而資源是在 Web 應用程式中共用 (例如 web.config 檔案)。

在單一伺服器陣列中合併多個承租人時,請針對所有已驗證內容使用專用 SharePoint Web 應用程式,並針對所有匿名內容使用不同的專用 Web 應用程式。對於具有這兩種內容類型的承租人而言,這需要兩個不同訂閱識別碼。這也會簡化授權。

部分 SharePoint 功能繫結至 Web 應用程式層級 (例如「自助網站集合架設」設定)。開啟它之後,相同 Web 應用程式下的所有承租人都將可以建立網站集合。

單一伺服器陣列環境設計

在隔離承租人資料和管理的多組織主控環境中,分割和共用服務的設定十分重要。此範例提供分割服務的實際實作,也提供如何部署客戶網站的建議。

此範例詳述可用來將客戶網站部署至伺服器陣列的下列方式:

  • 專用應用程式集區和 Web 應用程式

  • 共用應用程式集區和專用 Web 應用程式

  • 共用 Web 應用程式

    • 已驗證網站

    • 未驗證網站

只有在需要滿足隔離需求時,每個客戶才需要使用專用應用程式集區。針對需要進行影響資源之自訂的承租人,請使用專用 Web 應用程式,而資源是在 Web 應用程式中共用 (例如 web.config 檔案)。

在單一 Web 應用程式中合併多個承租人時,請針對所有已驗證內容使用專用 Web 應用程式,並針對所有匿名內容使用不同的專用 Web 應用程式。對於具有這兩種內容類型的承租人而言,這需要兩個不同訂閱識別碼。這也會簡化授權。

不允許在網站中部署完全信任程式碼。

不允許影響共用資源 (例如 web.config 檔案) 的自訂。

在下列範例 (已驗證網站) 中,每個公司都會使用不同的主機命名型網站集合。公司 C 包括兩個不同的主機命名型網站集合。在每個最上層主機命名型網站集合下,受管理路徑是用來建立網站之最上層網站集合的第二層 (例如小組網站、我的網站、已發佈內部網路內容或不同的部門網站)。

分層環境設計

如前所述,規劃多承租人 SharePoint Server 2013 主控平台時需要考慮許多事項,其中這些因素是成本、簡化管理、資源隔離、效能和延展性。

隨著客戶群規模日益成長,您會發現很難符合單一環境中所有客戶的所有需求。此時,為了讓那些因素取得平衡,就需要進行特定取捨。

如果是這種情況,則可能會想要考慮使用的替代方式就是分層環境設計,其中有多個 SharePoint 環境符合您客戶的各種需要。每個環境都著重在服務方案的不同層面,例如,低成本、高密度、更高的資源隔離,以及成本較高的更佳服務品質 (QoS) 等。

此分層環境設計方式可以提供不同的服務等級協定供客戶使用。因此,您可以為更多客戶提供服務、簡化管理和作業、降低管理成本,以及提升利潤率。

安全考量

本節討論規劃和設計多承租人 SharePoint Server 2013 主控平台的各種安全考量。從現在開始,談論人員選擇設定的任何各節 (例如<組織單位 (OU)>小節) 只在未進行其他 Windows 驗證自訂時才能運作。

SharePoint Server 2013 支援下列驗證類型的許多驗證方法和驗證提供者:

  • Windows 驗證

  • 表單型驗證

  • SAML Token 型驗證

Windows 驗證類型利用現有的 Windows 驗證提供者及 Windows 網域環境用來驗證連線用戶端之認證的驗證通訊協定。宣告式驗證和傳統模式使用的 Windows 驗證方法包括:

  • NTLM

  • Kerberos

  • 摘要

  • 基本

表單型驗證 (FBA) 是宣告式身分識別管理系統,以 ASP.NET 成員資格與角色提供者驗證為基礎。您可以對儲存在下列驗證提供者的認證使用宣告式驗證:

  • Active Directory 網域服務 (AD DS)

  • 資料庫 (例如 SQL Server 資料庫)

  • 輕量型目錄存取通訊協定 (LDAP) 資料存放區 (例如 Novell eDirectory、Novell Directory Services (NDS) 或 Sun ONE)

表單型驗證會根據使用者以登入表單形式 (通常為網頁) 輸入的認證來驗證使用者。未經驗證的要求會重新導向至登入頁面,使用者必須在該頁面提供有效認證再送出表單。系統會發出驗證要求的 Cookie,包含用於重新建立較新要求之身分識別的金鑰。

若在使用表單型驗證時,根據不是以 Windows 為基礎的身分識別管理系統或外部身分識別管理系統來驗證使用者,則必須在數個 web.config 檔案中登錄成員資格提供者及角色管理員。SharePoint Server 2013 使用標準 ASP.NET 角色管理員介面,收集目前使用者的群組資訊。SharePoint Server 2013 的授權程序會將每一個 ASP.NET 角色視為一個網域群組。在 web.config 檔案登錄角色管理員的方法,與登錄用於驗證之成員資格提供者的方法完全相同。

若要從管理中心網站管理成員資格使用者或角色,您必須在 web.config 檔案中為管理中心網站登錄成員資格提供者及角色管理員。您還必須在主控內容之 Web 應用程式的 web.config 檔案以及 Security Token Service 的 web.config 檔案中登錄成員資格提供者及角色管理員。

SharePoint Server 2013 的 SAML Token 型驗證使用 SAML 1.1 通訊協定和 WS-同盟被動式要求者設定檔 (WS-F PRP),需與宣告式環境 (無論是貴組織本身內部環境或是合作夥伴環境) 的管理員進行協調。如果使用 Active Directory Federation Services (AD FS) 2.0,則會具有 SAML Token 型驗證環境。

針對使用宣告式驗證的 Web 應用程式,人員選擇是 SharePoint Server 2013 內提供的一種控制項。人員選擇控制項使用宣告提供者來列出、解析、搜尋以及判斷使用者、群組和宣告的「好記」顯示。如需人員選擇設定的其他資訊,請參閱人員選擇與宣告提供者概觀

區域代表存取 Web 應用程式中同一個網站的不同邏輯路徑。每個 Web 應用程式最多可包含五個區域。當您建立 Web 應用程式時,管理中心會建立 Default 區域。若要建立其他區域,請擴充 Web 應用程式,並從其餘區域名稱中選取其中之一:[內部網路]、[外部網路]、[網際網路] 或 [自訂]。

組織單位

組織單位 (OU) 組織 Active Directory 環境中的使用者和電腦物件。基於主控目的,則能以如下圖所示組織組織單位結構。

此圖顯示主控環境的組織單位結構

您至少會想要將群組原則連結至網域根目錄、網域控制器 OU、SharePoint Server OU 和客戶 OU。

網域根目錄

套用至整個網域的安全性已套用到網域原則。這些設定包含在套用至整個網域的群組原則物件 (GPO) 中。

網域控制器 OU

網域控制器保留組織中的最機密資料 (即控制安全設定本身的資料)。此層級所套用的 GPO 是用來設定和保護網域中的網域控制器。

SharePoint Server OU

SharePoint 伺服器具有的唯一 角色未包括在目錄的其他伺服器中。將這些伺服器放在其專屬 OU,可將唯一原則套用至這些伺服器。它們也可以與目錄中的其他伺服器隔離。需要建立不同 GPO (例如匿名存取內容伺服器與已驗證內容伺服器) 時,可以建立子 OU。

客戶 OU

這個最上層 OU 可隔離所有使用者帳戶與目錄的其餘部分。OU 的下一個層級包含客戶 OU。一個客戶會有一個 OU。這可以隔離客戶與其他客戶的所有使用者帳戶和電腦帳戶。此外,這是支援多承租人部署中 User Profile Synchronization 的必要 OU 結構。

為了讓使用者認為他們登入其專屬自訂網域,請使用 Active Directory Service Interfaces Editor (ADSI Edit) 或另一個 AD 工具來編輯每個客戶 OU 的 uPNSuffixes 屬性 (如下圖所示)

此圖顯示 uPNSuffixes 屬性的 ADSI 屬性編輯器對話方塊

設定客戶 OU 的 uPNSuffixes 屬性之後,它的值將可以與該客戶 OU 內的使用者帳戶相關聯 (如下圖所示)。

此圖顯示可讓您建立新使用者的新物件對話方塊

使用者驗證

使用者驗證是根據驗證提供者對使用者身分識別進行的驗證,驗證提供者是包含使用者認證並可確認使用者正確提交認證的目錄或資料庫,例如 Active Directory 網域服務 (AD DS)。其他驗證提供者的一般名稱還包括「使用者目錄」和「屬性存放區」。

驗證方法是帳戶認證與宣告使用者身分識別之其他資訊的特定交換。驗證方法的結果是驗證提供者驗證使用者的證明,通常使用包含宣告的 Token 格式。

驗證類型是根據一或多個驗證提供者驗證認證的特定方式,有時會使用業界標準通訊協定。一種驗證類型可以使用多種驗證方法。

確認使用者身分識別之後,授權程序即可決定使用者所能存取的網站、內容及其他功能。

規劃使用者驗證類型和方法時應該決定下列事項:

  • 每個 Web 應用程式和區域的使用者驗證類型和方法。

  • 支援決定使用之驗證類型和方法所需的驗證基礎結構。

  • 如何將目前使用傳統模式驗證的 Web 應用程式和區域移轉為使用宣告式驗證。

Active Directory Federation Services (AD FS)

SharePoint Server 2013 支援宣告式驗證。Active Directory Federation Services (AD FS) 可以設定成做為 SharePoint Server 2013 Web 應用程式的身分識別提供者 Security Token Service (IP-STS)。在此設定中,AD FS 發出包含宣告的 SAML 安全性 Token,讓用戶端電腦可以存取使用宣告式驗證的 Web 應用程式。您可以使用非 AD FS 的替代身份識別提供者。但是必須支援 WS-Federation 標準。同時,使用 AD FS 設定,需要有自訂程式碼。

如需如何設定 SAML型宣告驗證與 AD FS for SharePoint Server 2013 的其他資訊,請參閱在 SharePoint 2013 中使用 AD FS 設定 SAML 式宣告驗證

管理和作業考量

本節討論多承租人 SharePoint Server 2013 環境的各種管理和作業考量。

容量管理

因為內容及使用不會停歇,所以「內容管理」這項程序也會持續不斷地進行。您必須規劃成長與變更,讓 SharePoint Server 2013 環境能夠一直提供有效率的商務方案。如需 SharePoint Server 2013 中容量管理的其他資訊,請參閱SharePoint Server 2013 的容量管理及調整大小概觀

應用程式管理

SharePoint 應用程式有新方法可以將特定的資料或功能傳送給 SharePoint 網站。SharePoint 相關應用程式是一支小型的獨立應用程式,用法十分簡單,可以滿足某些特殊使用者或商務的需求。網站擁有者可以在公用的 SharePoint 市集或組織內容的應用程式目錄探索及下載 SharePoint 應用程式,再將其安裝到自己的 SharePoint 網站。這些 SharePoint 應用程式集結了多項網路功能,可以讓 SharePoint Server 2013 如虎添翼。這些功能不會取代 SharePoint 功能與解決方案套件,而只會自訂或增加 SharePoint 網站。不同於需要伺服器陣列或網站集合管理員安裝的功能與解決方案,SharePoint 應用程式是獨立的應用程式,網站擁有者只需要將其加入 SharePoint 網站即可。SharePoint 應用程式的流程十分簡單,網站擁有者可以安裝、升級及取消安裝。

SharePoint Server 2013 中的 App Management Service 具有多重租用功能。大部分應用程式設定和管理功能是透過承租人管理網站公開,並允許每個承租人管理員設定其個別設定。

備份和還原

在多承租人 SharePoint Server 2013 主控平台上執行與承租人無關的備份和還原作業時,您可以遵循在 SharePoint Server 2013 環境上執行備份和還原作業的一般指引,請參閱SharePoint Server 的備份與還原

請注意,在 SharePoint Server 2013 中,Workflow 平台與 SharePoint 平台不同。因此,Workflow Manager 上的備份和還原作業應該與 SharePoint 備份和還原作業一致,確保兩者同步。如需如何規劃 Workflow Service Manager 之備份和還原作業的其他指引,請參閱<Workflow Manager 1.0 中的災害復原和範圍還原>。

在多承租人 SharePoint Server 2013 主控平台上執行承租人特定備份和還原作業時,您可能需要將下列具有承租人功能的元件與另一個元件同步:服務應用程式、工作流程、內容資料庫和網站集合。

服務應用程式

以分割模式設定的服務應用程式會有一或多個含有承租人特定資料的相關聯資料庫。同時在應用程式和資料庫層級對這些服務應用程式執行一般備份和還原作業時,具有有限的命令,可對這些服務應用程式或其資料庫執行承租人特定詳細備份和還原作業。

服務應用程式考量

App Management Service

App Management Service 是用於管理 SharePoint Server 2013 中所引進 SharePoint 相關應用程式 功能的服務應用程式。SharePoint 應用程式有新方法可以將特定的資料或功能傳送給 SharePoint 網站。SharePoint 相關應用程式是一支小型的獨立應用程式,用法十分簡單,可以滿足某些特殊使用者或商務的需求。App Management Service 不支援分割模式,不過,它原本具有網站訂閱功能。在多承租人 SharePoint 環境中,大部分 App Management 功能 (即 [管理 應用程式目錄]、[管理應用程式授權]、[應用程式權限] 等) 的取得是使用承租人管理網站。

下圖顯示承租人管理網站上的 App Management。

此圖顯示應用程式管理的租用戶管理網站

Business Data Connectivity Service

以分割模式設定之後,Business Data Connectivity Service 的所有設定都會移到承租人管理。不過,承租人管理網站範本不包括此頁面的連結 (其可以使用<擴充承租人管理網站範本>一節中的自訂技術予以新增)。

Secure Store Service

以分割模式設定之後,加密金鑰的產生還是會透過管理中心或 Windows PowerShell 執行伺服器陣列層級設定。Secure Store Service 設定的其餘部分會移到承租人管理。不過,承租人管理網站範本不包括此頁面的連結 (其可以使用<擴充承租人管理網站範本>一節中的自訂技術予以新增)。

Managed Metadata Service

以分割模式設定之後,所有設定都會移到承租人管理,而且預設會啟用內容類型發佈。

Search Service

承租人管理網站中會公開許多承租人特定搜尋設定相關功能 (如下圖所示)。

此圖顯示位於租用戶管理網站上的搜尋管理功能

注意

許多 .EnterpriseSearch Microsoft PowerShell Cmdlet 現在都具有分割功能,而且可以用來自動化承租人管理網站中公開的一些設定和管理功能。

User Profile Service

大量的設定元素會移到承租人管理,不過,Profile Synchronization 的大部分設定都會保持在伺服器陣列層級,而且適用於所有承租人 (如下圖所示)。

此圖說明「使用者設定檔」設定

工作流程

如前所述,在 SharePoint Server 2013 中,Workflow 平台與 SharePoint 平台不同。Workflow 平台本身使用一或多個資料庫。您可以對這些資料庫執行一般資料庫層級備份和還原作業時,沒有命令或公用程式可以對這些 Workflow 資料庫執行承租人特定備份和還原作業。

內容資料庫

如果承租人具有一或多個專用內容資料庫的專用使用權,則您可以對這些資料庫執行一般資料庫層級備份和還原作業。

注意

使用標準產品功能 (例如,自助網站架設) 無法達成具有一或多個專用內容資料庫的專用使用權。這是符合特定服務層級方案時需要自訂的範例。

下列 Microsoft PowerShell 指令碼顯示如何對承租人內容資料庫執行初始備份動作。

Add-PSSnapin microsoft.sharepoint.powershell -ea SilentlyContinue

Backup-SPFarm -Directory "c:\backups\alpha" -Item "HostingFarm_Content_Hosting" -BackupMethod Full

Write-Host "Tenant Content Database Backup Script Completed!"

The following Windows PowerShell script shows how to perform a restore operation on a tenant site collection:
Add-PSSnapin microsoft.sharepoint.powershell -ea SilentlyContinue

Restore-SPFarm -Directory "c:\backups\alpha" -Item "HostingFarm_Content_Hosting" -RestoreMethod Overwrite

Write-Host "Tenant Content Database Restore Script Completed!"

網站集合

您可以對承租人網站集合執行特定備份和還原作業。您選擇使用的工具取決於網站集合本身的大小。Microsoft PowerShell Cmdlet 是小到中型網站集合的適當選擇。

下列 Microsoft PowerShell 指令碼顯示如何對承租人網站集合執行備份動作。

Add-PSSnapin microsoft.sharepoint.powershell -ea SilentlyContinue

Backup-SPSite -Identity "http://alpha.contoso.com" -Path "c:\backups\alpha\root.bak" -UseSqlSnapshot

Write-Host "Tenant Site Collection Backup Script Completed!"

The following script shows how to perform a restore operation on a tenant site collection:
Add-PSSnapin microsoft.sharepoint.powershell -ea SilentlyContinue

Restore-SPSite -Identity "http://alpha.contoso.com" -Path "c:\backups\alpha\root.bak" -DatabaseServer "SQLServer01" -DatabaseName "HostingFarm_Content_Hosting" -HostHeaderWebApplication "http://$ENV:COMPUTERNAME" -GradualDelete - Confirm: $false -Force

Write-Host "Tenant Site Collection Restore Script Completed!"

監視

有許多工具可讓您監視 SharePoint Server 2013 和疑難排解問題。不同的工具針對環境的不同方面,不過其中有許多重疊的部分。請仔細思考哪些工具可以徹底發揮監視的用途。如需如何規劃 SharePoint Server 2013 之監視的其他指引,請參閱監視 SharePoint Server 中的計劃

功能套件管理

如前所述,功能套件可用於將不同的功能分組,以及建立它們與網站訂閱 (即承租人) 的關聯性。該網站訂閱 (承租人) 中的所有網站集合都只能使用屬於功能套件一部分的網站範圍或 Web 範圍功能。此功能可讓服務提供者根據不同組的功能來提供分層服務方案。建立的功能套件是使用 New-SPSiteSubscriptionFeaturePack Cmdlet 來建立功能套件容器,以及使用 Add-SPSiteSubscriptionFeaturePackMember Cmdlet 將個別功能新增至該容器。

下列 Microsoft PowerShell 指令碼顯示如何建立可代表 SharePoint Foundation 2013 功能的承租人層級功能套件,以及在伺服器陣列屬性包中儲存功能套件 ID。

注意

必須要有 Subscription Settings Service 應用程式,才能執行與功能套件搭配使用的指令碼。

<#
   Feature Packs.ps1

    Creates a new Feature Pack comprised of SharePoint Foundation 2013 Features
    Adds the Feature Pack ID with a friendly name to the Farm's Property Bag for future use.


    
#>
asnp Microsoft.SharePoint.PowerShell

# Create an alias for Add-SPSiteSubscriptionFeaturePackMember 
Set-Alias AddFeature Add-SPSiteSubscriptionFeaturePackMember

# create a new feature pack, and store it in the Farm's Property Bag
$ffp = New-SPSiteSubscriptionFeaturePack
$farm = Get-SPFarm
$farm.Properties.Add("Foundation_FeaturePack", $ffp.Id);
$farm.Update();

# add foundation features to the feature pack

# web scoped features...
AddFeature -identity $ffp -FeatureDefinition  XmlFormLibrary
AddFeature -identity $ffp -FeatureDefinition  LinksList
AddFeature -identity $ffp -FeatureDefinition  WorkflowProcessList
AddFeature -identity $ffp -FeatureDefinition  GridList
AddFeature -identity $ffp -FeatureDefinition  WorkflowHistoryList
AddFeature -identity $ffp -FeatureDefinition  TeamCollab
AddFeature -identity $ffp -FeatureDefinition  GanttTasksList
AddFeature -identity $ffp -FeatureDefinition  PictureLibrary
AddFeature -identity $ffp -FeatureDefinition  IssuesList
AddFeature -identity $ffp -FeatureDefinition  DiscussionsList
AddFeature -identity $ffp -FeatureDefinition  ContactsList
AddFeature -identity $ffp -FeatureDefinition  ExternalList
AddFeature -identity $ffp -FeatureDefinition  TasksList
AddFeature -identity $ffp -FeatureDefinition  WebPageLibrary
AddFeature -identity $ffp -FeatureDefinition  AnnouncementsList
AddFeature -identity $ffp -FeatureDefinition  WikiPageHomePage
AddFeature -identity $ffp -FeatureDefinition  CustomList
AddFeature -identity $ffp -FeatureDefinition  DocumentLibrary
AddFeature -identity $ffp -FeatureDefinition  SurveysList
AddFeature -identity $ffp -FeatureDefinition  EventsList
AddFeature -identity $ffp -FeatureDefinition  DataSourceLibrary
AddFeature -identity $ffp -FeatureDefinition  NoCodeWorkflowLibrary
AddFeature -identity $ffp -FeatureDefinition  OsrvLinks
AddFeature -identity $ffp -FeatureDefinition  FCGroupsList
AddFeature -identity $ffp -FeatureDefinition  TenantAdminBDC
AddFeature -identity $ffp -FeatureDefinition  OssNavigation
AddFeature -identity $ffp -FeatureDefinition  IMEDicList
AddFeature -identity $ffp -FeatureDefinition  CallTrackList
AddFeature -identity $ffp -FeatureDefinition  SSSvcAdmin
AddFeature -identity $ffp -FeatureDefinition  MpsWebParts
AddFeature -identity $ffp -FeatureDefinition  GBWWebParts
AddFeature -identity $ffp -FeatureDefinition  FacilityList
AddFeature -identity $ffp -FeatureDefinition  ScheduleList
AddFeature -identity $ffp -FeatureDefinition  ObaProfilePages
AddFeature -identity $ffp -FeatureDefinition  GBWProvision
AddFeature -identity $ffp -FeatureDefinition  OSSSearchSearchCenterUrlFeature
AddFeature -identity $ffp -FeatureDefinition  WikiWelcome
AddFeature -identity $ffp -FeatureDefinition  MaintenanceLogs
AddFeature -identity $ffp -FeatureDefinition  TenantAdminLinks
AddFeature -identity $ffp -FeatureDefinition  HolidaysList
AddFeature -identity $ffp -FeatureDefinition  GroupWork
AddFeature -identity $ffp -FeatureDefinition  WhereaboutsList
AddFeature -identity $ffp -FeatureDefinition  CirculationList
AddFeature -identity $ffp -FeatureDefinition  TenantAdminSecureStore
AddFeature -identity $ffp -FeatureDefinition  SearchAdminWebParts
AddFeature -identity $ffp -FeatureDefinition  ObaSimpleSolution
AddFeature -identity $ffp -FeatureDefinition  TimecardList
AddFeature -identity $ffp -FeatureDefinition  WhatsNewList
AddFeature -identity $ffp -FeatureDefinition  MobilityRedirect
AddFeature -identity $ffp -FeatureDefinition  AdminLinks
AddFeature -identity $ffp -FeatureDefinition  SearchCenterLiteFiles
AddFeature -identity $ffp -FeatureDefinition  CorporateCatalog
AddFeature -identity $ffp -FeatureDefinition  BlogContent
AddFeature -identity $ffp -FeatureDefinition  PromotedLinksList
AddFeature -identity $ffp -FeatureDefinition  AppLockdown
AddFeature -identity $ffp -FeatureDefinition  AppRequestsList
AddFeature -identity $ffp -FeatureDefinition  SearchCenterUpgrade
AddFeature -identity $ffp -FeatureDefinition  SearchConfigFields
AddFeature -identity $ffp -FeatureDefinition  PhonePNSubscriber
AddFeature -identity $ffp -FeatureDefinition  SearchConfigContentType
AddFeature -identity $ffp -FeatureDefinition  GettingStarted
AddFeature -identity $ffp -FeatureDefinition  GettingStartedWithAppCatalogSite
AddFeature -identity $ffp -FeatureDefinition  ExternalSubscription
AddFeature -identity $ffp -FeatureDefinition  SearchCenterFiles
AddFeature -identity $ffp -FeatureDefinition  BcsEvents
AddFeature -identity $ffp -FeatureDefinition  OfficeExtensionCatalog
AddFeature -identity $ffp -FeatureDefinition  MDSFeature
AddFeature -identity $ffp -FeatureDefinition  TenantSearchAdmin
AddFeature -identity $ffp -FeatureDefinition  SiteAssets
AddFeature -identity $ffp -FeatureDefinition  PremiumSearchVerticals
AddFeature -identity $ffp -FeatureDefinition  AccessRequests
AddFeature -identity $ffp -FeatureDefinition  SearchConfigList
AddFeature -identity $ffp -FeatureDefinition  ReportAndDataSearch
AddFeature -identity $ffp -FeatureDefinition  MBrowserRedirect
AddFeature -identity $ffp -FeatureDefinition  BlogHomePage
AddFeature -identity $ffp -FeatureDefinition  SearchConfigListTemplate
AddFeature -identity $ffp -FeatureDefinition  SiteNotebook
AddFeature -identity $ffp -FeatureDefinition  HierarchyTasksList
AddFeature -identity $ffp -FeatureDefinition  BlogSiteTemplate
AddFeature -identity $ffp -FeatureDefinition  SearchCenterLiteUpgrade

# Site Scoped features...                                                                                                                                                                                               
AddFeature -identity $ffp -FeatureDefinition  BasicWebParts
AddFeature -identity $ffp -FeatureDefinition  OSSSearchEndUserHelpFeature
AddFeature -identity $ffp -FeatureDefinition  HelpLibrary
AddFeature -identity $ffp -FeatureDefinition  OfficeWebApps
AddFeature -identity $ffp -FeatureDefinition  WordServerViewing
AddFeature -identity $ffp -FeatureDefinition  OnenoteServerViewing
AddFeature -identity $ffp -FeatureDefinition  SiteHelp
AddFeature -identity $ffp -FeatureDefinition  ctypes
AddFeature -identity $ffp -FeatureDefinition  OSSSearchSearchCenterUrlSiteFeature
AddFeature -identity $ffp -FeatureDefinition  OpenInClient
AddFeature -identity $ffp -FeatureDefinition  ExcelServerEdit
AddFeature -identity $ffp -FeatureDefinition  AdminReportCore
AddFeature -identity $ffp -FeatureDefinition  fields
AddFeature -identity $ffp -FeatureDefinition  SearchServerWizardFeature
AddFeature -identity $ffp -FeatureDefinition  OSearchHealthReports
AddFeature -identity $ffp -FeatureDefinition  SearchWebParts
AddFeature -identity $ffp -FeatureDefinition  IssueTrackingWorkflow
AddFeature -identity $ffp -FeatureDefinition  ShareWithEveryone
AddFeature -identity $ffp -FeatureDefinition  MonitoredApps
AddFeature -identity $ffp -FeatureDefinition  SearchTaxonomyRefinementWebParts
AddFeature -identity $ffp -FeatureDefinition  SearchTaxonomyRefinementWebPartsHtml
AddFeature -identity $ffp -FeatureDefinition  SearchMaster
AddFeature -identity $ffp -FeatureDefinition  EnableAppSideLoading
AddFeature -identity $ffp -FeatureDefinition  Developer
AddFeature -identity $ffp -FeatureDefinition  AutohostedAppLicensing
AddFeature -identity $ffp -FeatureDefinition  AppRegistration

Write-Host "Feature Pack Created! " + $ffp.ID

授權管理

在 SharePoint Server 2013 中,已新增授權管理功能。伺服器陣列管理員現在可以將授權指派給使用者並啟用執行階段授權檢查。使用此新功能,即可確保只有具有適當授權的使用者才能使用特定功能。此功能也會簡化部署模型,因為您不再需要為 SharePoint Server 標準和企業版建置不同的伺服器陣列。

將宣告對應到已知的授權類型,即可指派使用者授權。例如,假設宣告是 Active Directory 網域服務 (AD DS) 安全性群組。將 ContosoFinanceDept 安全性群組對應到企業版授權,就可以將企業版授權有效率地指派給該群組的所有成員。如果使用者無權使用特定功能,則登入 SharePoint Server 的使用者可獲指派宣告。SharePoint Server 會檢查使用者的宣告以判定其授權。SharePoint 將會在執行階段封鎖對該功能的存取。

這個 SharePoint Server 2013 授權實作方式是透過使用新的 Microsoft PowerShell Cmdlet 來管理。SharePoint Server 預設停用授權。不過,管理員可以選擇使用 Microsoft PowerShell 來開啟它。如需如何在 SharePoint Server 2013 中設定授權的其他資訊,請參閱在 SharePoint Server 2013 中設定授權

生命週期管理

此白皮書概述設計多承租人 SharePoint 2013 方案時的重要基礎結構考量,而且提供作業生命週期整體管理重要設定的基準指令碼。例如,自訂承租人管理、取消佈建訂閱、封存、使用者管理、自助密碼重設和數量都是一般區塊,其需要某個其他 Windows PowerShell 和自訂作業的組合,才能提供完整服務方案。每個服務提供者都有此領域的不同需求,因此確保這些需求屬於基礎結構平台的初始範圍和設計工作極為重要。

安裝和設定

本節概述安裝和設定多承租人主控 SharePoint Server 2013 平台的一般步驟。

致謝

本節提供詳細資料,並包含示範如何建立和設定各種元件的 PowerShell 指令碼。提供這些指令碼的目的通常是要示範多重租用的設定需求,因此不會呈現最佳佈建順序,不過,可以做為開發專屬自訂端對端指令碼方案的基礎。

下列子小節中所含的 Microsoft PowerShell 指令碼是全部或局部根據 Spencer Harbar (http://www.harbar.net),並自行在這裡重新產生。請參閱其原始工作的下列文件。

提供的 PowerShell 指令碼包括多個變數,您應該可以修改這些變數以符合環境。

部署範例

本節所呈現的部署範例使用利用主機命名型網站集合和主機標頭受管理路徑的單一主控 Web 應用程式。基於簡化原因,它是部署於單一伺服器,這是多重租用 (含 SharePoint 2013) 的預定設計模型,而且可以擴充到在多個電腦中接合服務執行個體角色的部署。此部署範例針對 Web 應用程式使用 HTTP。在實際部署中,應該使用 SSL 來保護與 SharePoint 應用程式和其他 OAuth2 相關服務 (例如 Workflow Manager) 搭配使用之登入、內容和授權 Token 的 SSL。

DNS 設定

因為主機命名型網站集合將用於多承租人 SharePoint 環境,所以您必須根據計畫來設定 DNS (亦即,建立適當的 DNS 記錄等)。如需如何規劃 SharePoint Server 2013 之主機命名型網站集合的其他指引,請參閱SharePoint Server 中已指定主機的網站集合架構與部署

如果您也想要支援 SharePoint 應用程式,則也必須設定 DNS 支援您的環境。如需如何設定 SharePoint Server 2013 之應用程式環境的其他資訊,請參閱設定 SharePoint Server 相關應用程式的環境

Active Directory 設定

如前所述,若要支援 SharePoint 中的多重租用,必須建立階層組織單位結構正確地建構 Active Directory 以支援每個訂閱的 User Profile Synchronization。您也需要為環境建立適當的服務帳戶。如需如何規劃 SharePoint Server 2013 之服務帳戶的其他資訊,請參閱規劃 SharePoint Server 中的管理及服務帳戶。在此部署範例中,使用下列三個服務帳戶:

  • SPFarm - SharePoint 伺服器陣列帳戶

  • SPServices - 可主控服務應用程式端點的應用程式集區身份識別

  • SPContent - 可主控內容 Web 應用程式的應用程式集區身份識別

SharePoint 伺服器陣列 建立和設定

下列 Microsoft PowerShell 指令碼顯示如何建立 SharePoint 伺服器陣列。

<#
    1. Farm Creation.ps1

    Creates a new SharePoint Farm
    Creates Central Administration on Port 8080

    Update initial variables as needed to reflect your environment
    Script will prompt for the password of the farm account
#>
asnp Microsoft.SharePoint.PowerShell

$databaseServer = "SQLSP1"
$configDatabase = "HostingFarm_Config"
$adminContentDB = "HostingFarm_Content_Admin"
$passphrase = "Password1"
$farmAccountName = "FABRIKAM\spfarm"
  
$farmAccount = Get-Credential $farmAccountName
$passphrase = (ConvertTo-SecureString $passphrase -AsPlainText -force)

Write-Host "Creating Configuration Database and Central Admin Content Database..."
New-SPConfigurationDatabase -DatabaseServer $databaseServer -DatabaseName $configDatabase `
    -AdministrationContentDatabaseName $adminContentDB `
    -Passphrase $passphrase -FarmCredentials $farmAccount
    
$spfarm = Get-SPFarm -ErrorAction SilentlyContinue -ErrorVariable err        
if ($spfarm -eq $null -or $err) {
   throw "Unable to verify farm creation."
}


Write-Host "ACLing SharePoint Resources..."
Initialize-SPResourceSecurity
Write-Host "Installing Services ..."
Install-SPService   
Write-Host "Installing Features..."
Install-SPFeature -AllExistingFeatures

Write-Host "Creating Central Administration..."              
New-SPCentralAdministration -Port 8080 -WindowsAuthProvider NTLM

Write-Host "Installing Help..."
Install-SPHelpCollection -All        
Write-Host "Installing Application Content..."
Install-SPApplicationContent

Write-Host "Farm Creation Done!" 

Proxy 群組、主控 Web 應用程式和受管理路徑

一開始,受管理帳戶是針對可主控內容 Web 應用程式的應用程式集區所建立。接著會建立後接 Web 應用程式的新 Proxy 群組。最後,設定 Web 應用程式以允許架設自助網站以及建立共用受管理路徑。在主控 Web 應用程式中建立「根」網站集合極為重要,即使使用者不會存取此網站集合也是一樣。這是 SharePoint 2013 的支援性和正確作業行為的必要項目。

注意

此範例針對 Web 應用程式使用 HTTP。

<#
    2. Proxy Group, Web Application & Farm Settings.ps1

    Creates a new Managed Account
    Creates a new Proxy Group
    Creates a new Web Application for HNSC, in a new Application Pool, in the new Proxy Group
    Creates an empty root Site Collection
    Enables Self Service Site Creation
    Creates Managed Paths for HNSC
    


    Update initial variables as needed to reflect your environment
    Update the Managed Paths section to use the paths you need
    Script will prompt for the password of the App Pool account used for the Web App
    You will need to configure the SSL certificate manually or via IIS PowerShell

#>
asnp Microsoft.SharePoint.PowerShell

## UPDATE THESE VARS ##
$waAppPoolUserName = "FABRIKAM\spcontent"
$waAppPoolName = "SharePoint Hosting"
$proxyGroupName = "Hosting Proxy Group"

$waUrl = "http://$ENV:COMPUTERNAME"
$webAppName = "SharePoint Hosting"
$contentDBName = "HostingFarm_Content_Hosting"
$ownerEmail = "administrator@contoso.com"
$ownerAlias = "FABRIKAM\administrator"
## END VARS ##



# Create Managed Account
Write-Host "Please supply the password for the $waAppPoolUserName Account..."
$appPoolCred = Get-Credential $waAppPoolUserName
Write-Host "Creating Managed Account..."
$waAppPoolAccount = New-SPManagedAccount -Credential $appPoolCred

# Create a new Proxy Group
Write-Host "Creating Proxy Group..."
$proxyGroup = New-SPServiceApplicationProxyGroup -Name $proxyGroupName

# Create a new Web App in the new Proxy Group using Windows Claims on Port 80 with no host header
Write-Host "Creating Web Application..."
# SSL example, not used
#$webApp = New-SPWebApplication -ApplicationPool $waAppPoolName -ApplicationPoolAccount $waAppPoolAccount -Name $webAppName -Port 443 -SecureSocketsLayer:$true -AuthenticationProvider (New-SPAuthenticationProvider) -DatabaseName $contentDBName -ServiceApplicationProxyGroup $proxyGroup
# following line is to use port 80
$webApp = New-SPWebApplication -ApplicationPool $waAppPoolName -ApplicationPoolAccount $waAppPoolAccount -Name $webAppName -Port 80 -AuthenticationProvider (New-SPAuthenticationProvider) -DatabaseName $contentDBName -ServiceApplicationProxyGroup $proxyGroup 

# Create a empty root Site Collection, required for support and SSSC
Write-Host "Creating empty root Site Collection..."
New-SPSite -Url $waUrl -owneralias $ownerAlias -ownerEmail $ownerEmail

# Enable Self Service Site Creation 
Write-Host "Enabling Self Service Site Creation..."
$webApp.SelfServiceSiteCreationEnabled = $true
$webApp.RequireContactForSelfServiceSiteCreation = $false
$webApp.Update()

# Create Managed Paths for all 2013 Tenancy capabilities (remove the ones you don't want)
# the default /sites path is removed to prevent creation of sites from CA
Write-Host "Creating HNSC Managed Paths..."
Remove-SPManagedPath "sites" -WebApplication $webApp -Confirm:$false
New-SPManagedPath "admin" -HostHeader -Explicit # Tenant Administration
New-SPManagedPath "apps" -HostHeader -Explicit  # App Catalog
New-SPManagedPath "cthub" -HostHeader -Explicit # Content Type Hub
New-SPManagedPath "my" -HostHeader -Explicit    # MySite Host
New-SPManagedPath "my/sites" -HostHeader        # MySites
New-SPManagedPath "edisc" -HostHeader -Explicit # E-Discovery Hub


Write-Host "Proxy Group and Web Application done!"

非分割服務

在此階段,可以建立非分割服務應用程式。在伺服器陣列中,標準作業需要這些服務應用程式 (例如 State Service),或不需要分割這些服務應用程式即可支援多重租用,因為它們不會儲存任何資料。若要這麼做,需要另一個受管理帳戶,接著會建立每個服務應用程式。

下列 Microsoft PowerShell 指令碼顯示如何建立非分割服務應用程式。

<#
    3. Non Partitioned Services.ps1

    Creates a new Managed Account
    Creates a new Service Application Pool
    
    Starts the Service Instances for and creates non partitioned Service Applications and Proxies:
        State Service
        Usage and Health Data Collection Service
        Subscription Settings Service
        App Management Service
        Work Management Service

    ...in the new Proxy Group 

    Adds any configured Workflow Service Proxy to the new Proxy Group

    Update initial variables as needed to reflect your environment
    Script will prompt for the password of the Service Application Pool account

    
    
#>
asnp Microsoft.SharePoint.PowerShell


## UPDATE THESE VARS ##
$proxyGroupName = "Hosting Proxy Group"
$saAppPoolName = "SharePoint Web Services Default"
$saAppPoolUserName = "FABRIKAM\spservices"

# Service Application and DB names
$stateName = "State Service"
$stateDBName = "HostingFarm_StateService"

$usageName = "Usage and Health Data Collection Service"
$usageDBName = "HostingFarm_Usage"

$subsName = "Subscription Settings Service"
$subsDBName = "HostingFarm_SubscriptionSettings"

$appsName = "App Management Service"
$appsDBName = "HostingFarm_AppManagement"

$wmsName = "Work Management Service"

$pasName = "PowerPoint Automation Service"
## END VARS ##


# Create Managed Account and App Pool for Service App Endpoints
Write-Host "Please supply the password for the $saAppPoolUserName Account..."
$appPoolCred = Get-Credential $saAppPoolUserName
Write-Host "Creating Managed Account..."
$saAppPoolAccount = New-SPManagedAccount -Credential $appPoolCred
Write-Host "Creating Service Application Pool..."
$saAppPool = New-SPServiceApplicationPool -Name $saAppPoolName -Account $saAppPoolAccount

# Grab the Proxy Group
$proxyGroup = Get-SPServiceApplicationProxyGroup $proxyGroupName

# Create State Service Application and Proxy, add to Proxy Group
Write-Host "Creating $stateName Application and Proxy..."
$stateDB = New-SPStateServiceDatabase -Name $stateDBName
$state = New-SPStateServiceApplication -Name $stateName -Database $stateDB
$proxy = New-SPStateServiceApplicationProxy -Name "$stateName Proxy" -ServiceApplication $state
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy

# Create Usage Service Application and Proxy, add to Proxy Group, and provision it's Proxy
Write-Host "Creating $usageName Application and Proxy..."
$serviceInstance = Get-SPUsageService
New-SPUsageApplication -Name $usageName -DatabaseName $usageDBName -UsageService $serviceInstance
$proxy = Get-SPServiceApplicationProxy | ? { $_.TypeName -eq "Usage and Health Data Collection Proxy" }
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy
$proxy.Provision();

# Start the Subscription Settings Service Instance, create the Service Application and Proxy, add to Proxy Group
Write-Host "Creating $subsName Application and Proxy..."
Get-SPServiceInstance | where { $_.TypeName -eq "Microsoft SharePoint Foundation Subscription Settings Service" } | Start-SPServiceInstance
$subs = New-SPSubscriptionSettingsServiceApplication -ApplicationPool $saAppPool -Name $subsName -DatabaseName $subsDBName
$proxy = New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $subs 
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy

# Start the App Management Service Instance, create the  Service Application and Proxy, add to Proxy Group
Write-Host "Creating $appsName Application and Proxy..."
Get-SPServiceInstance | where { $_.TypeName -eq "App Management Service"} | Start-SPServiceInstance
$apps = New-SPAppManagementServiceApplication -ApplicationPool $saAppPool -Name $appsName -DatabaseName $appsDBName
$proxy = New-SPAppManagementServiceApplicationProxy -ServiceApplication $apps -Name "$appsName Proxy"
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy

# Start the Work Management Service Instance, create the Service Application and Proxy, add to Proxy Group
Write-Host "Creating $wmsName Application and Proxy..."
Get-SPServiceInstance | ? { $_.TypeName -eq "Work Management Service" } | Start-SPServiceInstance
$wms = New-SPWorkManagementServiceApplication -ApplicationPool $saAppPool -Name $wmsName
$proxy = New-SPWorkManagementServiceApplicationProxy -ServiceApplication $wms -Name "$wmsName Proxy"
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy

# Start the PowerPoint Automation Service Instance, create the Service Application and Proxy, add to Proxy Group
Write-Host "Creating $pasName Application and Proxy..."
Get-SPServiceInstance | ? { $_.TypeName -eq "PowerPoint Conversion Service" } | Start-SPServiceInstance
$pas = New-SPPowerPointConversionServiceApplication -ApplicationPool $saAppPool -Name $pasName
$proxy = New-SPPowerPointConversionServiceApplicationProxy -ServiceApplication $pas -Name "$pasName Proxy"
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy

# Adds any Workflow Service proxy to the Proxy Group (if it exists)
$wfProxy = Get-SPServiceApplicationProxy | ? {$_.TypeName -like "*Workflow Service*" }
if ($wfProxy -ne $null) {
    Write-Host "Adding Workflow Service Proxy to Proxy Group..."
    # should probably remove from the default group as well
    Add-SPServiceApplicationProxyGroupMember -Identity $proxyGroup -Member $wfProxy
}

Write-Host "Non Partitioned Service Applications done!"

分割服務應用程式的建立和設定

下列小節說明建立和設定每個支援分割之服務應用程式所需的 Microsoft PowerShell 程序。相同的一般模式適用於每個服務應用程式,但 Search 和 User Profile 例外。不過,與服務應用程式 Proxy 相關的差異會有些許不同。

Business Data Connectivity Service

下列 Microsoft PowerShell 指令碼顯示如何以分割模式建立 Business Data Connectivity Service 應用程式,以及將它新增至自訂服務 Proxy 群組。

$proxyGroupName = "Hosting Proxy Group"
$saAppPoolName = "SharePoint Web Services Default"

$bcsName = "Business Data Connectivity Service"
$bcsDBName = "HostingFarm_BusinessDataConnectivity"


# Grab the Service Application Pool and Proxy Group
Write-Host "Getting Service Application Pool and Proxy Group..."
$saAppPool = $saAppPoolName | Get-SPServiceApplicationPool
$proxyGroup = Get-SPServiceApplicationProxyGroup $proxyGroupName

# Start Business Data Connectivity Service Instance, create the Service Application and Proxy, add to Proxy Group
Write-Host "Creating $bcsName Application and Proxy..."
Get-SPServiceInstance | ? { $_.TypeName -eq "Business Data Connectivity Service" } | Start-SPServiceInstance
$bcs = New-SPBusinessDataCatalogServiceApplication -PartitionMode -Name $bcsName -ApplicationPool $saAppPool -DatabaseName $bcsDBName 
$proxy = Get-SPServiceApplicationProxy | ? { $_.Name -eq "$bcsName" }
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy

Managed Metadata Service

下列 Microsoft PowerShell 指令碼顯示如何以分割模式建立 Managed Metadata Service 應用程式,以及將它新增至自訂服務 Proxy 群組。

$proxyGroupName = "Hosting Proxy Group"
$saAppPoolName = "SharePoint Web Services Default"

$mmsName = "Managed Metadata Service"
$mmsDBName = "HostingFarm_ManagedMetadata"

# Grab the Service Application Pool and Proxy Group
Write-Host "Getting Service Application Pool and Proxy Group..."
$saAppPool = $saAppPoolName | Get-SPServiceApplicationPool
$proxyGroup = Get-SPServiceApplicationProxyGroup $proxyGroupName

# Start the Managed Metadata Service Instance, create the Service Application and Proxy, add to Proxy Group
Write-Host "Creating $mmsName Application and Proxy..."
Get-SPServiceInstance | ? { $_.TypeName -eq "Managed Metadata Web Service" } | Start-SPServiceInstance
$mms = New-SPMetadataServiceApplication -PartitionMode -Name $mmsName -ApplicationPool $saAppPool -DatabaseName $mmsDBName
$proxy = New-SPMetadataServiceApplicationProxy -PartitionMode -Name "$mmsName Proxy" -ServiceApplication $mms
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy

Machine Translation Service

Machine Translation Service 支援多重租用,方法是以分割模式建立其服務應用程式。在伺服器陣列層級未管理任何承租人特定設定和服務。其資料庫有效地做為佇列,因此,而且具有分割/承租人功能。

下列 Microsoft PowerShell 指令碼顯示如何以分割模式建立 Machine Translation Service 應用程式。

$proxyGroupName = "Hosting Proxy Group"
$saAppPoolName = "SharePoint Web Services Default"

$mtsName = "Machine Translation Service"
$mtsDBName = "HostingFarm_MachineTranslation"

# Grab the Service Application Pool and Proxy Group
Write-Host "Getting Service Application Pool and Proxy Group..."
$saAppPool = $saAppPoolName | Get-SPServiceApplicationPool
$proxyGroup = Get-SPServiceApplicationProxyGroup $proxyGroupName


# Start Machine Translation Service Instance, create the Service Application and Proxy, add to Proxy Group
Write-Host "Creating $mtsName Application & proxy..."
Get-SPServiceInstance | ? { $_.TypeName -eq "Machine Translation Service" } | Start-SPServiceInstance
$mts = New-SPTranslationServiceApplication -PartitionMode -Name $mtsName -ApplicationPool $saAppPool -DatabaseName $mtsDBName
Get-SPServiceApplicationProxy | ? {$_.Name -eq $mtsName} | Remove-SPServiceApplicationProxy -Confirm:$false
$proxy = New-SPTranslationServiceApplicationProxy -PartitionMode -Name "$mtsName Proxy" -ServiceApplication $mts
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy

Secure Store Service

以分割模式設定之後,加密金鑰的產生還是會透過管理中心或 Windows PowerShell 執行伺服器陣列層級設定。Secure Store Service 設定的其餘部分會移到承租人管理。不過,承租人管理網站範本不包括此頁面的連結 (其可以使用<擴充承租人管理網站範本>小節中的自訂技術予以新增)。

下列 Microsoft PowerShell 指令碼顯示如何以分割模式建立 Secure Store Service 應用程式,以及將它新增至自訂服務 Proxy 群組。

$proxyGroupName = "Hosting Proxy Group"
$saAppPoolName = "SharePoint Web Services Default"

$sssName = "Secure Store Service"
$sssDBName = "HostingFarm_SecureStore"
$sssAuditing = $false
$sssSharing = $false
$sssAuditLogMaxSize = ""

# Grab the Service Application Pool and Proxy Group
Write-Host "Getting Service Application Pool and Proxy Group..."
$saAppPool = $saAppPoolName | Get-SPServiceApplicationPool
$proxyGroup = Get-SPServiceApplicationProxyGroup $proxyGroupName


# Start Secure Store Service Instance, create the Service Application and Proxy, add to Proxy Group
Write-Host "Creating $sssName Application & Proxy..."
Get-SPServiceInstance | ? { $_.TypeName -eq "Secure Store Service" } | Start-SPServiceInstance
$sss = New-SPSecureStoreServiceApplication -PartitionMode -Name $sssName -ApplicationPool $saAppPool -DatabaseName $sssDBName -auditingEnabled:$sssAuditing -AuditlogMaxSize $sssAuditLogMaxSize -Sharing:$sssSharing
$proxy = New-SPSecureStoreServiceApplicationProxy -Name "$sssName Proxy" -ServiceApplication $sss
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy 

Search Service

下列 Microsoft PowerShell 指令碼顯示如何以分割模式建立 Search Service 應用程式。

注意

此服務應用程式的指令碼使用 Partitioned 參數,而非 PartitionMode 參數。

$proxyGroupName = "Hosting Proxy Group"
$saAppPoolName = "SharePoint Web Services Default"

$searchServerName = "$ENV:COMPUTERNAME" 
$searchName = "Search Service"
$searchDBName = "HostingFarm_Search"

# Grab the Service Application Pool and Proxy Group
Write-Host "Getting Service Application Pool and Proxy Group..."
$saAppPool = $saAppPoolName | Get-SPServiceApplicationPool
$proxyGroup = Get-SPServiceApplicationProxyGroup $proxyGroupName

# Start Search Service Instances, create the Service Application and Proxy, add to Proxy Group, configure Topology
Write-Host "Starting Search Service Instances..."
Start-SPEnterpriseSearchServiceInstance $searchServerName
Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $searchServerName
Write-Host "Creating Search Service Application and Proxy..."
$search = New-SPEnterpriseSearchServiceApplication -Partitioned -Name $searchName -ApplicationPool $saAppPool -DatabaseName $searchDBName
$proxy = New-SPEnterpriseSearchServiceApplicationProxy -Partitioned -Name "$searchName Proxy" -SearchApplication $search
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy

# Clone the default Topology (which is empty) and create a new one and then activate it
Write-Host "Configuring Search Component Topology..."
$clone = $search.ActiveTopology.Clone()
$searchServiceInstance = Get-SPEnterpriseSearchServiceInstance
New-SPEnterpriseSearchAdminComponent -SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $clone -SearchServiceInstance $searchServiceInstance 
New-SPEnterpriseSearchCrawlComponent -SearchTopology $clone -SearchServiceInstance $searchServiceInstance 
New-SPEnterpriseSearchIndexComponent -SearchTopology $clone -SearchServiceInstance $searchServiceInstance
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $clone -SearchServiceInstance $searchServiceInstance
$clone.Activate()
Write-Host "Search complete!"

Word Automation Services

Word Automation Services 服務應用程式支援分割模式。沒有 Cmdlet 可以建立 Proxy。

下列 Microsoft PowerShell 指令碼顯示如何以分割模式建立 Word Automation Services 服務應用程式。

$proxyGroupName = "Hosting Proxy Group"
$saAppPoolName = "SharePoint Web Services Default"

$wasName = "Word Automation Service"
$wasDBName = "HostingFarm_WordAutomation"


# Grab the Service Application Pool and Proxy Group
Write-Host "Getting Service Application Pool and Proxy Group..."
$saAppPool = $saAppPoolName | Get-SPServiceApplicationPool
$proxyGroup = Get-SPServiceApplicationProxyGroup $proxyGroupName



# Start Word Automation Service Instance, create the Service Application and Proxy, add to Proxy Group
Write-Host "Creating $wasName Application & Proxy..."
Get-SPServiceInstance | ? { $_.TypeName -eq "Word Automation Services" } | Start-SPServiceInstance
$was = New-SPWordConversionServiceApplication -PartitionMode -Name $wasName -ApplicationPool $saAppPool -DatabaseName $wasDBName 
# we cannot change the name of this proxy as there is no New-SPWordConversionServiceApplicationProxy
$proxy = Get-SPServiceApplicationProxy | ? { $_.Name -eq $wasName }
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy 

User Profile Service

如果未以 SharePoint 伺服器陣列帳戶的身分執行 Windows PowerShell,則以分割模式佈建時需要使用 PowerShell 建立 User Profile Service 十分具有挑戰。為了暫時解決這個問題,以及為了順利啟動 User Profile Synchronization Service,我們利用 Start-Process Cmdlet,並以伺服器陣列帳戶的身分模擬執行指令碼。

需要兩個指令碼:第一個指令碼會建立 UPA,第二個指令碼則呼叫第一個指令碼。

下列 Microsoft PowerShell 指令碼顯示如何以分割模式建立 User Profile Service 應用程式,以及將它新增至自訂服務 Proxy 群組。

注意

應該直接執行此指令碼,否則會無法啟動 User Profile Synchronization Service 執行個體。此指令碼應該儲存在本機以及其記下的位置中。

<#
    partitionedUPAcreation.ps1

    External dependency to create UPA under farm account creds
    
#>
asnp Microsoft.SharePoint.PowerShell


$proxyGroupName = "Hosting Proxy Group"
$saAppPoolName = "SharePoint Web Services Default"

$upaName = "User Profile Service"
$upaProfileDBName = "HostingFarm_UserProfile_Profile"
$upaSocialDBName = "HostingFarm_UserProfile_Social"
$upaSyncDBName = "HostingFarm_UserProfile_Sync"


# Grab the Proxy Group
$proxyGroup = Get-SPServiceApplicationProxyGroup -Identity $mtProxyName

# Grab the Appplication Pool for Service Application Endpoint
$saAppPool = Get-SPServiceApplicationPool $saAppPoolName

<# Creates UPA Service Application & Proxy, and User Profile Service Instance
     If omitted, -ProfileSyncDBServer, -SocialDBServer & -ProfileDBServer are the SharePoint Default DB Server
     If omitted, -SyncInstanceMachine is the local machine 
#>
Write-Host "Creating $upaName Application & Proxy..."
$upa = New-SPProfileServiceApplication -PartitionMode -Name $upaName -ApplicationPool $saAppPoolName -ProfileDBName $upaProfileDBName -SocialDBName $upaSocialDBName -ProfileSyncDBName $upaSyncDBName
$proxy = New-SPProfileServiceApplicationProxy -PartitionMode -Name "$upaName Proxy" -ServiceApplication $upa
$proxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $proxy


# Check it worked
Get-SPServiceApplication | ? {$_.Name -eq $upaName} 

下面的第二個指令碼執行呼叫 UPA 建立指令碼以及啟動必要服務執行個體的必要工作。應該更新 $upaScriptFile 變數中的 UPA 建立指令碼位置。此外,部分必要權限設定於 UPA 上。

$proxyGroupName = "Hosting Proxy Group"
$saAppPoolName = "SharePoint Web Services Default"
$upaScriptfile = "c:\partitionedUPAcreation.ps1"

$upaName = "User Profile Service"
$user = "FABRIKAM\Administrator"
$serviceUser = "FABRIKAM\spservices"


# Grab the Service Application Pool and Proxy Group
Write-Host "Getting Service Application Pool and Proxy Group..."
$saAppPool = $saAppPoolName | Get-SPServiceApplicationPool
$proxyGroup = Get-SPServiceApplicationProxyGroup $proxyGroupName


# Start User Profile Service Instance
Write-Host "Starting User Profile Service Instance..."
Get-SPServiceInstance | ? { $_.TypeName -eq "User Profile Service" } | Start-SPServiceInstance

Write-Host "Restarting SPTimerV4..."
Restart-Service SPTimerV4

# Grab the Farm Account credentials
Write-Host "Please enter the Farm Account Password:"
$farmAcct = (Get-SPFarm).DefaultServiceAccount
$cred = Get-Credential $farmAcct.Name

# Create a new process to initiate User Profile Service Application creation under UAC elevation
Write-Host "Creating new process for UPA creation..."
Start-Process $PSHOME\powershell.exe -Credential $cred -ArgumentList "-Command Start-Process $PSHOME\powershell.exe -ArgumentList `"'$upaScriptfile'`" -Verb Runas" -Wait
Get-Date
Write-Host "UPA Created!"

# Start the User Profile Synchronization Service Instance
Write-Host "Starting the UPS Service Instance..."
Get-Date

$upa = Get-SPServiceApplication | where-object {$_.Name -eq $upaName}
$upsInstanceName = "User Profile Synchronization Service"


[String]$password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($cred.Password)); 
Get-SPServiceInstance | where-object {$_.TypeName -eq $upsInstanceName} | % {
    $_.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Provisioning
    $_.IsProvisioned = $false
    $_.UserProfileApplicationGuid = $upa.Id
    $_.Update()
    $upa.SetSynchronizationMachine($_.Server.Address, $_.Id, $cred.UserName, $password) # this can cause update conflicts
    Start-SPServiceInstance $_
}
Write-Host "Waiting on $upsInstanceName to provision..."
Write-Host "Baseline time is 130 seconds"
[int]$time = 0
$ups = Get-SPServiceInstance | where-object {$_.TypeName -eq $upsInstanceName}
while(-not ($ups.Status -eq "Online")){
   sleep 10;
    Write-Host "Still waiting... ($time seconds elapsed)"
    $ups = Get-SPServiceInstance | where-object {$_.TypeName -eq $upsInstanceName}
    $time = $time + 10
  }
Write-Host "$upsInstanceName provisioned, it took $time seconds."
Get-Date
Write-Host "UPS Service Instance Started"


# UPA Settings and Permissions, do this after UPS SI Started and Get it again to prevent update conflicts
Write-Host "Configuring NETBios Domain Names and UPA Permissions..."
$upa = Get-SPServiceApplication | where-object {$_.Name -eq $upaName}
$upa.NetBIOSDomainNamesEnabled=1
$upa.Update()   

function Grant-ServiceAppPermission($app, $user, $perm, $admin) {
    $sec = $app | Get-SPServiceApplicationSecurity -Admin:$admin
    $claim = New-SPClaimsPrincipal -Identity $user -IdentityType WindowsSamAccountName
    $sec | Grant-SPObjectSecurity -Principal $claim -Rights $perm
    $app | Set-SPServiceApplicationSecurity -ObjectSecurity $sec -Admin:$admin
}

Grant-ServiceAppPermission $upa $user "Full Control" $false
Grant-ServiceAppPermission $upa $serviceUser "Full Control" $false

資訊版權管理設定

使用 SharePoint 管理中心網站 或已更新的 Microsoft PowerShell Cmdlet 可以開啟多重租用的資訊版權管理支援。

使用 管理中心 開啟資訊版權管理

  1. 檢查執行此程序的使用者帳戶是否為「伺服器陣列管理員」SharePoint 群組與執行管理中心之電腦的管理員群組的成員。

  2. 從 管理中心 網站中,移至 [安全性]。

  3. 在 [安全性] 頁面上,移至 [設定資訊版權管理]。

  4. 在 [資訊版權管理] 頁面上,按一下 [使用此 RMS 伺服器]。

  5. 請務必勾選 [在多承租人設定中核取此方塊,允許承租人設定承租人等級的 IRM 設定]核取方塊。

使用 Microsoft PowerShell 開啟資訊版權管理

  1. 確認您具備下列成員身分:

    • SQL Server 執行個體上的 securityadmin 固定伺服器角色。

    • 所有要更新之資料庫上的 db_owner 固定資料庫角色。

    • 正在執行 PowerShell Cmdlet 之所在伺服器上的系統管理員群組。

    系統管理員可以使用 Add-SPShellAdmin Cmdlet 授與使用 SharePoint Server 2013 Cmdlet 的權限。

    注意

    如果您不具備上述權限,請連絡安裝程式系統管理員或 SQL Server 系統管理員要求權限。如需 PowerShell 權限的其他資訊,請參閱 Add-SPShellAdmin

  2. 開啟 [SharePoint 管理命令介面]

  3. 在 PowerShell 命令提示字元處,輸入下列命令:

    Set-SPIRMSettings -IrmEnabled -UseActiveDirectoryDiscovery -SubscriptionScopeSettingsEnabled
    

承租人管理網站內沒有 IRM 的內建設定選項。若要套用設定,請使用 Set-SPSiteSubscriptionIRMConfig Cmdlet (如下列指令碼所示):

$subscription=Get-SPSiteSubscription "https://www.contoso.com"
Set-SPSiteSubscriptionIRMConfig -identity $subscription -IrmEnabled -CertificateServerUrl "http://rms.contoso.com" 

通常這類設定是在佈建承租人時執行。

承租人佈建和管理

本節說明佈建承租人以及自訂多承租人環境的程序和方式。

承租人佈建

若要建立承租人,請依照表格中的步驟進行。

Tasks

Steps

1. 建立網站訂閱。

在 Microsoft PowerShell 命令提示字元處,輸入下列語法:

$sub = New-SPSiteSubscription

2. 將功能套件指派給網站訂閱,以及使用人員選擇來設定自訂 OU。

在 Microsoft PowerShell 命令提示字元處,輸入下列語法:

Set-SPSiteSubscriptionConfig -id $sub -FeaturePack $customerFeatures -UserAccountDirectoryPath "OU=$customerName,OU=Customers,DC=contoso,DC=com"

3. 建立要指派給網站訂閱的一或多個網站集合。

在 Microsoft PowerShell 命令提示字元處,輸入下列語法:

Write-Host "Creating Member Site..." 
New-SPSite -url "http://$customerName.contoso.com" -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template sts#0 -ContentDatabase $contentDBName
# create Tenant Admin site  
Write-Host "Creating Tenant Admin site..." 
New-SPSite -url "http://$customerName.contoso.com/admin" -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template tenantadmin#0 -AdministrationSiteType TenantAdministration -ContentDatabase $contentDBName
Write-Host "Creating My Site Host..." 
    New-SPSite -url "http://$customerName.contoso.com/mysites" -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template SPSMSITEHOST#0 -ContentDatabase $contentDBName

下列 PowerShell 指令碼顯示如何建立使用 TENANTADMIN#0 範本的承租人管理網站。如果承租人設定成使用 Enterprise Feature Pack,則 Microsoft PowerShell 指令碼會執行其他作業 (亦即,建立 我的網站 集合)。

Add-PSSnapin Microsoft.SharePoint.Powershell -EA 0  
 
# farm details (update to reflect your environment) 
$hostingMainURL = "http://$ENV:COMPUTERNAME"
$upaProxyName = "Tenant User Profile Service Proxy" 
$mmsProxyName = "Tenant Managed Metadata Service" 
$contentDBName = "HostingFarm_Content_Hosting" 

$farm = Get-SPFarm
$foundationFeaturePack = $farm.Properties.Foundation_FeaturePack
#$standardFeaturePack = $farm.Properties.Standard_FeaturePack
#$enterpriseFeaturePack = $farm.Properties.Enterprise_FeaturePack

# tenant-specific information (vary by tenant)
$customerName = "Customer A" 
$customerTenantAdmin = "CONTOSO\customerA-Admin"
$customerTenantAdminEmail = "admin@customerA.com"
$customerFeatures = $enterpriseFeatures
# Note: 
# this script assumes that the Content Web App and necessary Managed Paths exist. 

# grab the web app 
$webApp = Get-SPWebApplication $hostingMainURL 
 
# create new Site Subscription 
Write-Host "Creating Site Subscription..." 
$sub = New-SPSiteSubscription 
 
# assign feature pack and set the OU to be used by the People 
Write-Host "Assigning Feature Pack and configuring People Picker..." 
Set-SPSiteSubscriptionConfig -id $sub -FeaturePack $customerFeatures -UserAccountDirectoryPath "OU=$customerName,OU=Customers,DC=contoso,DC=com" 
 
# create the \"main\" member site (we need a site at the root to use Host Headers and Managed Paths in the following cmdlets) 
Write-Host "Creating Member Site..." 
New-SPSite -url "http://$customerName.contoso.com" -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template sts#0 -ContentDatabase $contentDBName
 
# create Tenant Admin site  
Write-Host "Creating Tenant Admin site..." 
New-SPSite -url "http://$customerName.contoso.com/admin" -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template tenantadmin#0 -AdministrationSiteType TenantAdministration -ContentDatabase $contentDBName
 
# everything else needs standard 
if (!($customerFeatures -eq $foundationFeatures)) 
{ 
    Write-Host "Tenant has SharePoint Server features" 
    # create a mysite host 
    Write-Host "Creating My Site Host..." 
    New-SPSite -url "http://$customerName.contoso.com/mysites" -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template SPSMSITEHOST#0 -ContentDatabase $contentDBName

    # configure the MySites host, MySites path, Naming Resolution and Profile Sync OU for the Subscription 
    Write-Host "Configuring Tenant Profile Config..." 
    $upaProxy = Get-SPServiceApplicationProxy | where-object {$_.DisplayName -eq $upaProxyName} 
    Add-SPSiteSubscriptionProfileConfig -id $sub -SynchronizationOU $customerName -MySiteHostLocation "http://$customerName.contoso.com/mysites" -MySiteManagedPath "/mysites/personal" -SiteNamingConflictResolution "None" -ProfileServiceApplicationProxy $upaProxy 
 
    # create a site for the Content Type Gallery 
    Write-Host "Creating Content Type Gallery..." 
    New-SPSite -url "http://$customerName.contoso.com/cthub" -SiteSubscription $sub -HostHeaderWebApplication $webApp -owneralias $customerTenantAdmin -owneremail $customerTenantAdminEmail -template sts#0 -ContentDatabase $contentDBName
 
    # configure the Content Type Gallery for the Subscription 
    Write-Host "Configuring Tenant Content Type Gallery..." 
    $mmsProxy = Get-SPServiceApplicationProxy | where-object {$_.DisplayName -eq $mmsProxyName} 
    # ContentTypeHub feature activation may fail - if so activate manually 
    Set-SPSiteSubscriptionMetadataConfig -identity $sub -serviceProxy $mmsProxy -huburi "http://$customerName.contoso.com/cthub" -SyndicationErrorReportEnabled 
    Write-Host "Activating Content Type Hub..." 
    Enable-SPFeature -Identity ContentTypeHub -url "http://$customerName.contoso.com/cthub" 
} 
     
Write-Host "Tenant Provisioning Script Completed!"  

此方式可以進一步自訂成包含 Workflow、Apps 和 IRM 這項項目的其他承租人設定。這類指令碼通常會封裝成函數或自訂 Cmdlet,以針對未來的承租人重複執行。

Workflow Service

SharePoint Server 2013 為工作流程帶來主要進展,包括完整宣告撰寫、REST 及服務匯流排傳訊、彈入延展性及受管理的服務可靠性等企業功能。SharePoint 2013 可以使用以 .NET Framework 4.5 之 Windows Workflow Foundation 元件為基礎的新工作流程服務。新的服務稱為 Workflow Manager,其設計目的是扮演企業的核心角色。

只有在下載並安裝新的 Workflow Manager Service,並設定它與 SharePoint Server 2013 伺服器陣列通訊之後,您與您的工具才能使用 SharePoint 2013 Workflow 平台。如需如何安裝和設定 SharePoint 2013 適用之 Workflow Manager Service 的其他資訊,請參閱安裝及設定 SharePoint Server 2013 工作流程

若要設定 Workflow Service,請使用 Register-SPWorkflowService Cmdlet,以向處於分割模式的 Workflow Service Manager 登錄伺服器陣列。在這樣做時,使用 SPSite 參數從伺服器陣列傳遞任何現有承租人網站集合的 URL,以及使用 ScopeName 參數定義伺服器陣列的具名工作流程範圍。

下列 Windows PowerShell 指令碼顯示如何向處於分割模式的 Workflow Service Manager 登錄 SharePoint 伺服器陣列。

Add-PSSnapin microsoft.sharepoint.powershell -ea SilentlyContinue 

# Register the Farm with the Workflow Service and create a workflow scope
# Note: any tenant site will suffice
Register-SPWorkflowService -SPSite "http://tenant.contoso.com" -WorkflowHostUri "http://WFSvr01:12291" -PartitionMode -AllowOAuthHttp -Force -ScopeName "HostingFarm"
 
Write-Host "Farm Workflow Registration Script Completed!"

若要啟用 SharePoint Workflow 的特定承租人,您必須設定工作流程服務 Proxy。在這樣做時,會取得承租人根網站集合的參照,並向工作流程服務 Proxy 登錄它。

下列 PowerShell 指令碼顯示如何啟用 SharePoint Workflow 的承租人。

Add-PSSnapin microsoft.sharepoint.powershell -ea SilentlyContinue 

#Get the Workflow Service Application Proxy
$wfProxy  = Get-SPWorkflowServiceApplicationProxy

#Create a credential object
$user = New-Object System.Net.NetworkCredential ("domain\Admin", "Password")

#Get the SPSite object of the root site collection of the tenant
$site = Get-SPSite http://tenant.domain.com

#Set the Workflow address for the tenant site (reference our workflow scope)
$wfProxy.SetWorkflowServiceAddress($site,"http://WFSvr01:12291/HostingFarm")

#Register the proxy with tenant site collection
$wfProxy.Register($site,$user)

#Connect the tenant site collection to the proxy
$wfProxy.Connect($site)  

Write-Host "Tenant Workflow Registration Script Completed!" 

承租人設定成使用 Workflow Service Manager 之後,您就可以使用 SharePoint Designer,以使用 SharePoint 2013 Workflow 選項來建立工作流程 (如下圖所示)。

此圖顯示 SharePoint Designer 中的 [SharePoint 2013 工作流程] 選項

擴充承租人管理網站範本

新增或移除連結

使用 [自訂動作定義結構描述],新增和移除承租人管理網站之主要頁面上的連結。

下列功能定義顯示如何新增群組、數個連結,以及移除 [管理網站集合] 頁面的連結。

<Elements xmlns="https://schemas.microsoft.com/sharepoint/">
  <CustomActionGroup
       Id="TenantAdmin_HostingUserAccounts"
       Location="Microsoft.SharePoint.TenantAdministration"
       Title="User Accounts"
       Sequence="90"
       ImageUrl="_layouts/images/SiteSettings_UsersAndPermissions_48x48.png">
    <UrlAction
        Url="" />
  </CustomActionGroup>
  <CustomAction
      Id="TenantAdmin_HostingUserAccounts_AddUser"
      GroupId="TenantAdmin_HostingUserAccounts"
      Location="Microsoft.SharePoint.TenantAdministration"
      Sequence="10"
      Title="Create User">
    <UrlAction
        Url="_layouts/UserAccountsWebParts/UA_AddUsers.aspx" />
  </CustomAction>
  <CustomAction
      Id="TenantAdmin_HostingUserAccounts_ManageUsers"
      GroupId="TenantAdmin_HostingUserAccounts"
      Location="Microsoft.SharePoint.TenantAdministration"
      Sequence="30"
      Title="Manage Users">
    <UrlAction
        Url="_layouts/UserAccountsWebParts/UA_ManageUsers.aspx" />
  </CustomAction>
  <HideCustomAction
    GroupId = "TenantAdmin_Sites"
    HideActionId = "TenantAdmin_Sites_ManageSiteCollections" 
    Location="Microsoft.SharePoint.TenantAdministration" />
</Elements>

如需自訂動作 (例如內建連結的預設識別碼) 的其他資訊,請參閱<自訂動作定義結構描述>。

自訂功能區

使用 [伺服器] 功能區 XML 和 ECMAScript (JavaScript、JScript),可以自訂 SharePoint Server 2013 中的 [伺服器] 功能區。XML 定義功能區上的控制項。ECMAScript 執行頁面上或頁面上物件的動作。您可以使用存在於 SharePoint FoundationECMAScript 物件模型或內建 ECMAScript 函數中的 ECMAScript。您也可以將專屬 ECMAScript 新增至頁面,並使用它與功能區互動。

自訂 [伺服器] 功能區時,您可以新增、取代以及移除控制項、群組和索引標籤。功能區自訂是使用功能中的 [伺服器] 功能區 XML 所定義,而且可以部署於方案套件 (.wsp 檔案) 中。可以使用 RegistrationIdRegistrationType 屬性,將功能區自訂的範圍設為特定清單類型。也可以在 Feature.xml 檔案中使用 Scope 屬性,將自訂的範圍設為網站或特定 Web 應用程式。

下列 XML 顯示如何取代 [管理網站集合] 頁面上 [磁碟配額] 按鈕的功能。

<Elements xmlns="https://schemas.microsoft.com/sharepoint/" >
  <CustomAction Id="Ribbon.Library.Actions.ReplacementButton"
      Location="CommandUI.Ribbon"
      Title="Replace a Ribbon Button">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.SiteCollections.Manage.DiskQuota">
          <Button Id="Ribbon.SiteCollections.Manage.DiskQuota.Replacement"
            Command="ReplacementButtonCommand"
            Image32by32="/_layouts/1033/images/formatmap32x32.png?vk=4536"
                  Image32by32Left="-256"
                  Image32by32Top="-224"
            LabelText="Disk Quota"
            TemplateAlias="o1" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler
          Command="ReplacementButtonCommand"
          CommandAction="javascript: 
         function demoCallback(dialogResult, returnValue)  
          {  
          }  
              var options = {               
                url: 'HostingTenantAdmin/DiskQuota.aspx', 
                tite: 'Manage Disk Quota', 
                allowMaximize: true, 
                showClose: true, 
                width: 610, 
                height: 450,
            dialogReturnValueCallback: demoCallback  }; 
              SP.UI.ModalDialog.showModalDialog(options);" />
      </CommandUIHandlers>
    </CommandUIExtension>
  </CustomAction>
</Elements>

如需如何自訂 [伺服器] 功能區的其他資訊,請參閱自訂伺服器功能區

使用自訂屬性擴充網站訂閱

Site Subscription Service 應用程式可以儲存管理自訂屬性和承租人自訂屬性。支援的屬性類型包括下列值:

  • string

  • int

  • long

  • bool

  • Guid

  • DateTime

您可以使用自訂屬性來擴充承租人管理功能 (例如承租人配額管理)。

下列 PowerShell 指令碼顯示如何存取自訂屬性。

Add-PSSnapin microsoft.sharepoint.powershell -ea SilentlyContinue

#-----------------------------------------------------
# Load Assemblies
#-----------------------------------------------------

[void] [Reflection.Assembly]::Load("Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")

#-----------------------------------------------------
# Functions
#-----------------------------------------------------

function GetSPSiteSubscription([string]$url)
{
    [Microsoft.SharePoint.SPSiteSubscription]$sub = Get-SPSiteSubscription $url;
    
    return $sub;
}

function GetSiteSubAdminProperties([string]$url)
{
    [Microsoft.SharePoint.SPSiteSubscription]$sub = GetSPSiteSubscription -url $url;
    [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager] $manager =  [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager]::Local;
    if ($manager -eq $null)
    {
        throw("Bad Manager!");
    }
    [Microsoft.SharePoint.SPSiteSubscriptionPropertyCollection]$props = $manager.GetAdminProperties($sub);
    if ($props -eq $null)
    {
        throw("Bad Props!");
    }
    return $props; 
}

function AddOrSetSiteSubAdminProperty([string]$url, [string]$theKey, $theValue)
{
    [Microsoft.SharePoint.SPSiteSubscription]$sub = GetSPSiteSubscription -url $url;
    [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager] $manager =  [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager]::Local;
    if ($manager -eq $null)
    {
        throw("Bad Manager!");
    }
    [Microsoft.SharePoint.SPSiteSubscriptionPropertyCollection]$props = $manager.GetAdminProperties($sub);
    if ($props -eq $null)
    {
        throw("Bad Props!");
    }
    if ($props.ContainsKey($theKey) -eq $true)
    {
        $props.SetValue($theKey, $theValue);
    }
    else
    {
        $props.Add($theKey, $theValue);
    }
    $props.Update(); 
}

function GetSiteSubAdminProperty([string]$url, [string]$theKey)
{
    [Microsoft.SharePoint.SPSiteSubscription]$sub = GetSPSiteSubscription -url $url;
    [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager] $manager =  [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager]::Local;
    if ($manager -eq $null)
    {
        throw("Bad Manager!");
    }
    [Microsoft.SharePoint.SPSiteSubscriptionPropertyCollection]$props = $manager.GetAdminProperties($sub);
    if ($props -eq $null)
    {
        throw("Bad Props!");
    }
    $theValue = "";
    if ($props.ContainsKey($theKey) -eq $true)
    {
        foreach ($prop in $props)
        {
            if ($prop.Key -eq $theKey) 
            {
                $theValue = $prop.Value;
                break;
            }
        }
        return $theValue;
    }
    else 
    {
        return $null;
    }
}


function RemoveSiteSubAdminProperty([string]$url, [string]$theKey)
{
    [Microsoft.SharePoint.SPSiteSubscription]$sub = GetSPSiteSubscription -url $url;
    [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager] $manager =  [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager]::Local;
    if ($manager -eq $null)
    {
        throw("Bad Manager!");
    }
    [Microsoft.SharePoint.SPSiteSubscriptionPropertyCollection]$props = $manager.GetAdminProperties($sub);
    if ($props -eq $null)
    {
        throw("Bad Props!");
    }
    if ($props.ContainsKey($theKey) -eq $true)
    {
        $props.Remove($theKey);
        $props.Update();
    }
}

function GetSiteSubTenantProperties($url)
{
    [Microsoft.SharePoint.SPSiteSubscription]$sub = GetSPSiteSubscription -url $url;
    [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager] $manager =  [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager]::Local;
    if ($manager -eq $null)
    {
        throw("Bad Manager!");
    }
    
    [Microsoft.SharePoint.SPSiteSubscriptionPropertyCollection]$props = $manager.GetProperties($sub);
    if ($props -eq $null)
    {
        throw("Bad Props!");
    }

    return $props; 
}

function AddOrSetSiteSubTenantProperty([string]$url, [string]$theKey, $theValue)
{
    [Microsoft.SharePoint.SPSiteSubscription]$sub = GetSPSiteSubscription -url $url;
    [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager] $manager =  [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager]::Local;
    if ($manager -eq $null)
    {
        throw("Bad Manager!");
    }
    [Microsoft.SharePoint.SPSiteSubscriptionPropertyCollection]$props = $manager.GetProperties($sub);
    if ($props -eq $null)
    {
        throw("Bad Props!");
    }
    if ($props.ContainsKey($theKey) -eq $true)
    {
        $props.SetValue($theKey, $theValue);
    }
    else
    {
        $props.Add($theKey, $theValue);
    }
    $props.Update(); 
}

function GetSiteSubTenantProperty([string]$url, [string]$theKey)
{
    [Microsoft.SharePoint.SPSiteSubscription]$sub = GetSPSiteSubscription -url $url;
    [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager] $manager =  [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager]::Local;
    if ($manager -eq $null)
    {
        throw("Bad Manager!");
    }
    [Microsoft.SharePoint.SPSiteSubscriptionPropertyCollection]$props = $manager.GetProperties($sub);
    if ($props -eq $null)
    {
        throw("Bad Props!");
    }
    $theValue = "";
    if ($props.ContainsKey($theKey) -eq $true)
    {
        foreach ($prop in $props)
        {
            if ($prop.Key -eq $theKey) 
            {
                $theValue = $prop.Value;
                break;
            }
        }
        return $theValue;
    }
    else 
    {
        return $null;
    }
}


function RemoveSiteSubTenantProperty([string]$url, [string]$theKey)
{
    [Microsoft.SharePoint.SPSiteSubscription]$sub = GetSPSiteSubscription -url $url;
    [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager] $manager =  [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager]::Local;
    if ($manager -eq $null)
    {
        throw("Bad Manager!");
    }
    [Microsoft.SharePoint.SPSiteSubscriptionPropertyCollection]$props = $manager.GetProperties($sub);
    if ($props -eq $null)
    {
        throw("Bad Props!");
    }
    if ($props.ContainsKey($theKey) -eq $true)
    {
        $props.Remove($theKey);
        $props.Update();
    }

See also

給主機服務提供者的 SharePoint Server 2013 一般指引