Publish External Content Type across farms

Overview:

I have two farms Farm A and Farm B. In Farm A I have configured Business Connectivity Service Application and Secure Store Service Application. In Farm A I have created an external content type for SQL data based on which I have created an external list. Both Business Connectivity Service and Secure Store Service application are published and in Farm B those two service applications are consumed. By using the published external content type I have created external list in Farm B. Any changes made in the external list in Farm 2 are reflected in Farm A also and vice - versa.

Business Connectivity Service

Prerequisites:

  1. Business Connectivity Service Application configured.
  2. Secure Store Service Application configured.
  3. Target Application ID created for BCS in Secure Store Service Application.

External Content Type:

Data Source:

I have created a database Test in SQL which contains a table, based on which we will create an external content type.

create database

Table Details:

"Table1" table has the following items.

table in database

Create External Content Type using SharePoint Designer 2010:

  1. Open SharePoint Designer 2010.

  2. Click on Open Site.

    SharePoint Designer2010

  3. Enter the site URL and click on Open.

  4. Go to Navigation => External Content Types => New => External Content Type.

    ExternalContent Type in sharepoint2010

  5. Enter the details as shown in the following.

    External Content Type informat

  6. Click on the link "Click here to discover external data sources and define operations".

  7. Click on "Add Connection".

  8. In the External Data Source Type selections select "SQL Server" and click on Ok.

    Externa lDataSource

  9. Enter the details as shown in the following.

    sq lserver connection

  10. Enter the credentials for BCS Secure Store ID and click on Ok.

    bcs secure store in sharepoint2010

  11. Right click on Table1 table and click on "Create all operations".

    create operation in sharepoint 2010

  12. Click Finish.

    operation created in sharepoint2010

  13. Save the external content type.

External List:

  1. Go to Navigation => Lists and Libraries=> New => External List.

    list and libraries in sharepoint 2010

  2. Select the content type that we have created, and then click on Ok.

  3. Enter the Name and Description for the list, and then click on Ok.

  4. Set the permissions:

    Once you have created the external content types using SharePoint Designer , Go to Central Administration => Application Management => Manage Service Applications => Business Connectivity Service application => you could be able to see the external content type that you have created using Designer as shown in the following.

    server application in sharepoint 2010

    Set the permission for the external content type (Referhttp://www.c-sharpcorner.com/UploadFile/anavijai/4252/).
     
  5. Go to the SharePoint Site where the external list is created. You could see the data as shown in the following

    create external list in sharepoint 2010

Publish Secure Store Service and Business Data Connectivity service application:

In Microsoft SharePoint Server 2010, Business Data Connectivity Service application can be shared across server farms. By publishing a service application, you can optimize resources, avoid redundancy, and provide enterprise-wide services without installing a dedicated enterprise services farm. Here we are going to publish and consume Business Data Connectivity Service application and Secure Store Service application across farms. The Publisher farm is the farm in which the Service application is running and the Consumer farm is the farm which will consume data from the publishing farm.

Steps that are required to publish and consume Service application across farms:

  • Exchange trust certificates between farms

  • Managing Trust Certificates

  • Publish an enterprise search service application

  • Set permission to the service application for a consuming farm

  • Connect to a Business Data Connectivity Service application on a remote farm

Exchange trust certificates between farms:

In Microsoft SharePoint Server 2010, a SharePoint farm can connect to and consume a service application that is published on another SharePoint Server 2010 farm. For this to occur, the farms must exchange trust certificates. You must use Windows Power Shell 2.0 commands to export and copy the certificates between farms. After the certificates are exported and copied, you can use either Windows Power Shell 2.0 commands or Central Administration to manage the trusts within the farm. To exchange trust certificates between farms the following steps should be followed.

Steps Involved:
  1. Exporting and copying certificates.
  2. Managing trust certificates
  1. Exporting and copying certificates:

    An administrator of the consuming farm must provide two trust certificates to the publishing farm: a root certificate and a security token service (STS) certificate. An administrator of the publishing farm must provide a root certificate to the consuming farm.

    To export the root certificate from the consuming farm:

          i.   In the consuming farm go to Start menu.

               start menu

          ii.  Go to SharePoint 2010 Management Shell and select Run as Administrator.

          iii. In the command prompt, type each of the following commands.

        $rootCert = (Get-SPCertificateAuthority).RootCertificate

        $rootCert.Export("Cert") | Set-Content "C:\Users\aaaaa\ConsumingFarmRoot.cer" -Encoding byte

        To export the STS certificate from the consuming farm:

          i. In the Command Prompt, type each of the following commands.

        $stsCert = (Get-SPSecurityTokenServiceConfig).LocalLoginProvider.SigningCertificate

        $stsCert.Export("Cert") | Set-Content "C:\Users\aaaaa\ConsumingFarmSTS.cer" -Encoding byte

        To export the root certificate from the publishing farm:

          i. In the Command Prompt, type each of the following commands.

       $rootCert = (Get-SPCertificateAuthority).RootCertificate

       $rootCert.Export("Cert") | Set-Content "C:\Users\aaaaa\PublishingFarmRoot.cer" -Encoding byte

       To copy the certificates:

         i. Copy the root certificate and the STS certificate from the server in the consuming farm to the server in the publishing farm.

         ii. Copy the root certificate from the server in the publishing farm to a server in the consuming farm.

   2. Managing Trust Certificates:

       Establishing trust on the consuming farm:

         i. To import the root certificate and create a trusted root authority on the consuming farm, type the following commands.

            $trustCert = Get-PfxCertificate "C:\Users\aaaaa\PublishingFarmRoot.cer"

            New-SPTrustedRootAuthority "PublishingFarm" -Certificate $trustCert

            Establishing trust on the publishing farm:

         ii. To import the root certificate and create a trusted root authority on the publishing farm, type the following commands.
            $trustCert = Get-PfxCertificate "C:\Users\aaaaa\ConsumingFarmRoot.cer"
            New-SPTrustedRootAuthority "ConsumingFarmRoot" -Certificate $trustCert

        iii. To import the STS certificate and create a trusted service token issuer on the publishing farm, type the following commands.

            $stsCert = Get-PfxCertificate "C:\Users\aaaaa\ConsumingFarmSTS.cer"

            New-SPTrustedServiceTokenIssuer "ConsumingFarmSTS" -Certificate $stsCert

Publish a Service Application:

  1. Go to the Central Administration->Application Management->Manage Service Applications => Select the service application that has to be published.

    application manegment in sharepoint 2010

  2. In the Ribbon click on Publish to publish Service Application.

  3. Publish Service application will be opened.

    publish server application sharepoint 2010
  4. Select the Connection Type that you want from the drop-down list.

  5. If you want the service application to be available to remote farms, select the check box for Publish this Service Application to other farms.

  6. In the Trusted farms column click the link you could see the trust relationship between farms that we have created.

  7. Copy the Published URL which should be provided by the consuming farm when connecting to the publishing farm.

Set permission to the published service application for a consuming farm:

  1. In the consuming farm go to Start menu.

  2. Go to SharePoint 2010 Management Shell and select Run as Administrator.

  3. In the command prompt, type each of the following commands.

  4. Get-SPFarm | Select Id

  5. The above command is used to get the farm id.

  6. Save the farm id.

  7. In the publishing farm go to the Central Administration->Application Management->Manage Service Applications.

    manege server application

  8. Click on Service Application. In the Ribbon select Permissions.

  9. Enter the farm id that you got from step 3 and click Add.

  10. In Permissions for Local Farm, select the Full Access to Term Store.

  11. Click OK.

Connect to a service application on a remote farm:

  1. In the consuming farm, go to the Central Administration->Application Management->Manage Service Applications.

    manege sever application

  2. In the Ribbon click on Connect.

    ribbon connect

  3. Enter the URL that we got when we published Service application in the publishing farm.

    publish farm in sharepoint 2010

  4. Click OK.

Business Data Connectivity Service application:

remot server application

Secure Store Service Application:

secure store server in sharepoint 2010

    v. Click the Service Application and check the Add this service application's proxy to the farm's default proxy list.

    vi. Click OK.

Business Data Connectivity Service Application:

bussiness data connectivity server

Secure Store Service Application:

secure store application proxy

    vii. Enter the Connection Name and click OK.

    viii. Now go and check it in the Central Administration->Application Management->Manage Service Applications.

    ix. You could see the Service application that we have published in the publishing farm.

Associate the service application connection with a local Web application:

Go to Central Administration =>Application Management => Manage Web Applications => Select the web application, then click on Service Associations in the ribbon interface => associate the service applications and click on Ok.

Consumed External Content Type:

Go to Central Administration =>Application Management => Manage Web Applications => DEV08 Business Data Connectivity Service Application Proxy. You could see the External Content Type that we have created in Farm A.

server application information in sharepoint 2010

Testing:

Go to the SharePoint Site, and create the external list based on the consumed external content type. You could see the following data

create external list in sharepoint 2010

Trying adding item to the external list that we have created. You could also see the changes in the external list created in Farm A.

Up Next
    Ebook Download
    View all
    Learn
    View all