Export (0) Print
Expand All

Step 8: Create the MVExtension

By enabling provisioning we will allow our objects in our SQL_Azure to be provisioned into the connector space of our AD Connector 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.

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

    //********************************************************
    //*                                                      *
    //*   Copyright (C) Microsoft. All rights reserved.      *
    //*                                                      *
    //********************************************************
    using System;
    using Microsoft.MetadirectoryServices;
    
    namespace Mms_Metaverse
    {
    /// <summary>
    /// Summary description for MVExtensionObject.
    /// </summary>
        public class MVExtensionObject : IMVSynchronization
        {
            public MVExtensionObject()
            {
                //
                // TODO: Add constructor logic here
                //
            }
    
            void IMVSynchronization.Initialize ()
            {
                //
                // TODO: Add initialization logic here
                //
            }
    
            void IMVSynchronization.Terminate ()
            {
                //
                // TODO: Add termination logic here
                //
            }
    
            void IMVSynchronization.Provision (MVEntry mventry)
            {
                ConnectedMA ManagementAgent;
                int Connectors = 0;
                CSEntry csentry;
                ReferenceValue DN;
    
                ManagementAgent = mventry.ConnectedMAs["SQL_Azure"];
                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["firstName"].Value;
                    csentry["LastName"].Value = mventry["lastName"].Value;
                    csentry["FullName"].Value = mventry["displayName"].Value;
                    csentry.CommitNewConnector();
                }
    
                if (1 == Connectors)
                {
                }
    
                ManagementAgent = mventry.ConnectedMAs["AD"];
                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;
                    csentry.CommitNewConnector();
                }
    
                if (1 == Connectors)
                {
                }
    
            }
    
            bool IMVSynchronization.ShouldDeleteFromMV (CSEntry csentry, MVEntry mventry)
            {
                //
                // TODO: Add MV deletion logic here
                //
                throw new EntryPointNotImplementedException();
            }
        }
    }
    
    
    
    
  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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft