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.
Prerequisites:
Business Connectivity Service Application configured.
Secure Store Service Application configured.
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.
Table Details:
"Table1" table has the following items.
Create External Content Type using SharePoint Designer 2010:
Open SharePoint Designer 2010.
Click on Open Site.
Enter the site URL and click on Open.
Go to Navigation => External Content Types => New => External Content Type.
Enter the details as shown in the following.
Click on the link "Click here to discover external data sources and define operations".
Click on "Add Connection".
In the External Data Source Type selections select "SQL Server" and click on Ok.
Enter the details as shown in the following.
Enter the credentials for BCS Secure Store ID and click on Ok.
Right click on Table1 table and click on "Create all operations".
Click Finish.
Save the external content type.
External List:
Go to Navigation => Lists and Libraries=> New => External List.
Select the content type that we have created, and then click on Ok.
Enter the Name and Description for the list, and then click on Ok.
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.
Set the permission for the external content type
Go to the SharePoint Site where the external list is created. You could see the data as shown in the following
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:
Exporting and copying certificates.
Managing trust certificates
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.
         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:
Go to the Central Administration->Application Management->Manage Service Applications => Select the service application that has to be published.
In the Ribbon click on Publish to publish Service Application.
Publish Service application will be opened.
Select the Connection Type that you want from the drop-down list.
If you want the service application to be available to remote farms, select the check box for Publish this Service Application to other farms.
In the Trusted farms column click the link you could see the trust relationship between farms that we have created.
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:
In the consuming farm go to Start menu.
Go to SharePoint 2010 Management Shell and select Run as Administrator.
In the command prompt, type each of the following commands.
Get-SPFarm | Select Id
The above command is used to get the farm id.
Save the farm id.
In the publishing farm go to the Central Administration->Application Management->Manage Service Applications.
Click on Service Application. In the Ribbon select Permissions.
Enter the farm id that you got from step 3 and click Add.
In Permissions for Local Farm, select the Full Access to Term Store.
Click OK.
Connect to a service application on a remote farm:
i. In the consuming farm, go to the Central Administration->Application Management->Manage Service Applications.
ii. In the Ribbon click on Connect.
iii. Enter the URL that we got when we published Service application in the publishing farm.
iv. Click OK.
Business Data Connectivity Service application:
Secure Store Service Application:
   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:
Secure Store Service Application:
   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.
Testing:
Go to the SharePoint Site, and create the external list based on the consumed external content type. You could see the following data
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.
Comments