Step 8: Create the MVExtension DLL

By enabling provisioning we will allow our objects in our SQL_ECMA2 to be provisioned into the connector space of our AD_ECMA2 and vice-versa. Creating the Metaverse Rules Extension consists of the following:

  • Create the metaverse rules extension DLL

  • Enable Provisioning

Create the metaverse rules extension DLL

Now we will create our metaverse rules extension DLL. This will be done using the code provided. A full copy of the code is provided in Appendix D: MVExtension Source Code

To create the new management agent DLL

  1. In the Synchronization Service, at the top, select Tools and then click Options. This will bring up the Options screen.

  2. In options, place a check in Enable metaverse rules extension. This will allow the Create Rules Extension Project button to become enabled.

  3. Click Create Rules Extension Project. This will bring up the Create Extension Project dialog.

  4. In the Create Extension Project dialog box, next to Programming Language: select Visual C#

  5. In the Create Extension Project dialog box, next to Visual Studio Version: select Visual Studio 2010.

  6. MV Rule 1

  7. Click OK. This will launch Visual Studio 2010.

  8. On the right, at the top, under the Solutions Explorer, double-click MVExtension.cs. This will open the file with code that has already been written.

  9. Scoll down to void IMVSynchronization.Provision (MVEntry mventry)

  10. . Remove the comments and add the code below

                ConnectedMA ManagementAgent;
                int Connectors = 0;
                CSEntry csentry;
                ReferenceValue DN;
                ManagementAgent = mventry.ConnectedMAs["SQL_ECMA2"];
                Connectors = ManagementAgent.Connectors.Count;
                //Provision to SQL
                if (0 == Connectors)
                    csentry = ManagementAgent.Connectors.StartNewConnector("Person");
                    csentry["EmployeeID"].Value = mventry["employeeID"].Value;
                    csentry["AccountName"].Value = mventry["accountName"].Value;
                    csentry["EMail"].Value = mventry["mail"].Value;
                    csentry["FirstName"].Value = mventry["givenName"].Value;
                    csentry["LastName"].Value = mventry["sn"].Value;
                    csentry["FullName"].Value = mventry["displayName"].Value;
                if (1 == Connectors)
                ManagementAgent = mventry.ConnectedMAs["AD_ECMA2"];
                Connectors = ManagementAgent.Connectors.Count;
                //Provision to AD
                if (0 == Connectors)
                    DN = ManagementAgent.EscapeDNComponent("CN=" + mventry["displayName"].Value).Concat("OU=ECMA2,DC=corp,DC=contoso,DC=com");
                    csentry = ManagementAgent.Connectors.StartNewConnector("user");
                    csentry.DN = DN;
                    csentry["samAccountName"].Value = mventry["accountName"].Value;
                    csentry["employeeID"].Value = mventry["employeeID"].Value;
                if (1 == Connectors)
  11. At the top, select Build and choose Build Solution from the drop-down. At the bottom, in the Output window you should see Build: 1 succeeded.

Enable Provisioning

In order to begin provisioning with the Synchronization Service, provisioning must be enabled. Use the steps below to enable provisioning.

To enable Provisioning

  1. Back in the Synchronization Service, the options screen should still be up.

  2. In the box next to Rule extension name:, click Browse. This will bring up the select File dialog.

  3. Select MVExtension.dll and click OK.

  4. Back on the options screen, place a check in Enable Provisioning Rules Extension.

    MV Rules 3