Tuesday 26 June 2012

Microsoft Dynamics CRM 2011 - Register an Azure-Aware Plug-in with Plug-in Registration Tool

This blog demonstrates how to configure Windows Azure Access Control Service (ACS) and register the ServiceBusPlugin plug-in using the Plug-in Registration tool. The ServiceBusPlugin plug-in is provided with Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online and supports posting the execution context of the current Microsoft Dynamics CRM operation to a Windows Azure solution endpoint. For this walkthrough, the plug-in is registered to post the execution context of the CreateRequest message for an Account entity.

The following prerequisites must be completed before starting this walkthrough:

  • Build the Plug-in Registration tool according to the instructions in its Readme file. For more information, see SDK\Tools\PluginRegistration\Readme.docx.  
  • Obtain access to Microsoft Dynamics CRM 2011 or Microsoft Dynamics CRM Online. 
  • Your system user account must have the System Customizer or System Administrator role to register a plug-in.
  • Have access to a Windows Azure platform service namespace, that uses ACS version 1 or 2, to which Microsoft Dynamics CRM will post a message.
Important: Only the Plug-in Registration tool from the 5.0.6 or newer version of the Microsoft Dynamics CRM SDK supports ACS v2.
  •  If you are using Microsoft Dynamics CRM 2011, the server must be configured for Windows Azure integration. 
  • There must be a listener application actively listening to the specified solution endpoint for Microsoft Dynamics CRM to successfully post.

Connect to the Microsoft Dynamics CRM Server

  •  Run the Plug-in Registration tool.
Note: The Microsoft.Crm.Sdk.Proxy.dll and Microsoft.Xrm.Sdk.dll assemblies must be in the same folder as the tool’s executable file or in your computer’s Global Assembly Cache (GAC) for the tool to run.
  •  Click Create New Connection.
  • In the Connections panel, enter a name for the connection, the URL of the server where the Microsoft Dynamics CRM Discovery service is hosted, and your logon system user name.
Connection Form Fields
Connection Form Fields
  • Check Use Saved Credentials if your logon credentials are saved in the Windows credential cache on your computer. Otherwise, do not check this box and you will be prompted to enter your password.
  • Click Connect. 
You should now see a list of available organizations that you belong to in the Connections panel.

Create a Service Endpoint Configuration

  • Double-click an organization in the Connections tree view.
  • Navigate to the Register menu and select Register New Endpoint.
  • Fill out the Service Endpoint Details dialog box with the information related to your solution as shown in the following figure and described in the table that follows. Make sure the contract you specify is the same contract used by your solution’s listener application.
Register a New Endpoint
Register a New Endpoint

UI Element: Name (field)   
Description: A name for your service endpoint registration.

UI Element: Description (field)  
Description: A description of this endpoint registration.

UI Element: Solution Namespace (field)  
Description: The name of the solution’s service namespace.

UI Element: Path (field)  
Description: The path of your project. For example, given a service endpoint URL of https://crmsdkdemo-sb.accesscontrol.windows.net/TwoWayService/Demo, the path is TwoWayService/Demo.

UI Element: Contract (drop-down menu)   
Description: The endpoint contract. A listener application must use this contract to read the posted message.
UI Element: Claim (drop-down menu)  
Description: The claims to send to Windows Azure. Use None for the standard claim. Specify UserId or UserInfo to send additional information about the logged on user.

UI Element: Federated Mode (checkbox)  
Description: Check this box to use federated mode.

UI Element: ID (field)
Description: Non-writeable field that is filled in automatically with the ID of your endpoint configuration.

UI Element: Save & Configure ACS (button)
Description: Saves the configuration you entered and automates the process of configuring ACS for you. Provides an interactive way.
UI Element: Save & Verify Authentication (button)
Description: Saves the configuration you entered and verifies that ACS is configured correctly.

UI Element: Save (button)
Description: Saves the configuration you entered and closes the dialog.
  • If you have not yet configured Windows Azure ACS integration with Microsoft Dynamics CRM, and you would like the Plug-in Registration tool to do the configuration for you, click Save & Configure ACS, and then follow the instructions in the next section of this walkthrough. If you have already configured ACS, click Save & Verify Authentication or Save and continue. 

Configure ACS

  • After clicking Save & Configure ACS, the ACS Configuration dialog box appears. 
Enter the appropriate data values into the form fields as described in the following table:  
Field Name: Management Key   
Description: The management key for your solution. You can obtain this key value from the Windows Azure Management Portal.

Field Name: Certificate File   
Description: The public certificate file that was used to configure Microsoft Dynamics CRM for integration with Windows Azure.

For Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online, you can download this certificate file from the server. In the Microsoft Dynamics CRM Web application select Settings, select Customizations, and then select Developer Resources. Download and save the certificate file.

Field Name: Issuer Name   
Description: The name of the issuer. This name must be the same name that was used to configure Microsoft Dynamics CRM for Windows Azure integration.
  • Click Configure ACS. A log of the configuration process is displayed in the output area of the form.
  • Click Close.
  • Click Save & Verify Authentication in the Service Endpoint Details dialog box. After the verification is finished you can close the dialog boxes. 

Register the ServiceBusPlugin Plug-in for an Event

  • Select the endpoint that you previously registered in the tree view of the tool.
  • Navigate to the Register menu and select Register New Step.
  • Fill out the Register New Step dialog box for an account create event as shown in the following figure.
Register an Endpoint Step
Register an Endpoint Step
  • Click Register New Step.
The ServiceBusPlugin plug-in will now post the current message containing the execution context to the Service Bus whenever an account is created. The post is performed asynchronously and is not executed immediately. 

Test the Endpoint Registration

After you register the endpoint you can test it. A listener must be running or a queue available on the target endpoint for the service bus post from the plug-in to happen.

Test the Endpoint Registration:

  1. Open the Microsoft Dynamics CRM Web application for the same organization that you registered the endpoint under. 
  2. Navigate to the workplace, select Accounts, and then click New.
  3. Enter an account name, for example: Adventure Works Cycle, into the Account Name field, then click Save & Close.
  4. Wait about 10 minutes for the post to occur.
  5. Select Settings, and then select System Jobs.
  6. Open the system job that has the same name that you specified for your service endpoint. Check the status to see if the post was successful, is waiting, or failed.
You can now unregister the endpoint, if so desired, by selecting it in the tool’s tree view and clicking Unregister.
My above blog is based on Microsoft's Official information.

I hope this blog about 'Microsoft Dynamics CRM 2011 - Register an Azure-Aware Plug-in with Plug-in Registration Tool' was informative. Please feel free to leave your comments.

1 comment:

  1. I saw the connective information about the plug-in device which roams the Microsoft Dynamics CRM of 2011 and it was very great. I really appreciate it so much and I owe you a lot for sharing this valuable information. Good post!

    ReplyDelete