Quantcast
Channel: Forum Microsoft Identity Manager
Viewing all articles
Browse latest Browse all 1783

MIM - Object Already Exists in Management Agent

$
0
0

We are currently migrating our student account provisioning from ILM to MIM, but I am running into an issue when trying to run a Full Sync on our SQL MA.  The only other MA is our AD MA.  I'm getting a provisioning error through our MV extension DLL saying that:

Microsoft.MetadirectoryServices.ObjectAlreadyExistsException: An object with DN "CN=Student Name,OU=2023,OU=BR,OU=Secondary Schools,OU=Students,OU=User Accounts,DC=our,DC=domain" already exists in management agent "Student_AD".
   at Microsoft.MetadirectoryServices.Impl.ConnectorImpl.Commit()
   at Mms_Metaverse.MVExtensionObject.Microsoft.MetadirectoryServices.IMVSynchronization.Provision(MVEntry mventry) in \\fim\c$\MIMRulesExtensions\MVExtension\MVExtension.cs:line 51
Line 51 is: csentry.CommitNewConnector(); from the code below.

 void IMVSynchronization.Provision (MVEntry mventry)
        {
            if ((mventry["employeeType"].Value == "Students") && (mventry["ou"].Value == "SECONDARY SCHOOLS"))
            {
                ConnectedMA StudentAD;
                CSEntry csentry;
                ReferenceValue dn;

                StudentAD = mventry.ConnectedMAs["Student_AD"];

                //Sets DN to "CN=[cn],OU=[division],OU=[location],OU=Secondary Schools,OU=Students,OU=UserAccounts,DC=our,DC=domain"
                dn = StudentAD.EscapeDNComponent("CN=" + mventry["cn"].Value).Concat("OU=" + mventry["division"].Value).Concat("OU=" + mventry["location"].Value).Concat("OU=SECONDARY SCHOOLS,OU=Students,OU=User Accounts,DC=our,DC=domain");

                if (StudentAD.Connectors.Count == 0)
                {
                    csentry = StudentAD.Connectors.StartNewConnector("user");
                    csentry.DN = dn;
                    csentry.CommitNewConnector();
                }

                else if (StudentAD.Connectors.Count == 1)
                {
                    csentry = StudentAD.Connectors.ByIndex[0];
                    csentry.DN = dn;
                }

                else
                {
                    string ExceptionMessage;
                    ExceptionMessage = "Multiple Connectors on Management Agent";
                    throw new UnexpectedDataException(ExceptionMessage);
                }
            }
        }	

I'm certainly no expert, but it seems to me like it's getting into the wrong if statement, when it should see the connector in the Student_AD MA and try to connect with that.

I've adapted this code from our MV extension for ILM (which was written in VB) and it looks the same to me, just not sure what's going wrong.  Here's the original code:

 If mventry("o").Value = "Students" And mventry("description").Value = "SECONDARY SCHOOLS" Then
                Dim stuMA As ConnectedMA
                Dim csentry As CSEntry
                Dim dn As ReferenceValue
                stuMA = mventry.ConnectedMAs("Admin_AD")
                ' Construct the distinguished name
                dn = stuMA.EscapeDNComponent("CN=" + _
        mventry("cn").Value).Concat("ou=" + _
        mventry("division").Value).Concat("ou=Users").Concat("ou=" + _
        mventry("l").Value).Concat("ou=" + _
        mventry("description").Value).Concat("dc=student,dc=our,dc=domain")
                If stuMA.Connectors.Count = 0 Then
                    csentry = stuMA.Connectors.StartNewConnector("user")
                    csentry.DN = dn
                    csentry.CommitNewConnector()
                ElseIf stuMA.Connectors.Count = 1 Then
                    ' Get the first connector and assign a new DN.
                    csentry = stuMA.Connectors.ByIndex(0)
                    csentry.DN = dn

Anyone have any advice?


Viewing all articles
Browse latest Browse all 1783

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>