FIM disconnect deprovision and new connector

894 views Asked by At

Hi I posted a question yesterday. However, I'm trying to find if the following can be done using FIM.

I'm importing user objects from AD and exporting to SQL table. Here is the SQL table design.

CREATE TABLE [dbo].[tbl_FGPP_Members](
    [MemberObjectGUID] [varbinary](50) NULL,
    [MemberDN] [nvarchar](255) NOT NULL,
    [MemberObjectType] [nvarchar](10) NOT NULL,
    [Member_ADDomain] [nvarchar](16) NULL,
    [Member_sAMAccountName] [nvarchar](64) NULL
) ON [PRIMARY]

I'm importing the AD user objects into mv:person and below are the flow rules.

enter image description here

I've got the stuff working so far. What I'm trying to do is when a rename happens in AD (like a user's distinguishedName changes, if they are moved or their cn value changes) then I would like FIM to delete the sql record and recreate new one with the new distinguishedname value for MemberDN column.

Is it possible to do this? in the metaverse provisioning code, I have the following:

      void IMVSynchronization.Provision (MVEntry mventry)
    {

        ConnectedMA sqlAnchorRenameUser;
        string mvObjectType = null;

switch (mventry.ObjectType)
            {

                case "SQLAnchorRenameUser":
                    sqlAnchorRenameUser = mventry.ConnectedMAs["SQL Anchor Rename SQLMA"];

                if (sqlAnchorRenameUser.Connectors.Count == 0)
                {
                    createAnchorRenameSQLUser(mventry, sqlAnchorRenameUser);
                }
                if (sqlAnchorRenameUser.Connectors.Count == 1)
                {
                    updateAnchorRenameSQLUser(mventry, sqlAnchorRenameUser);
                }


 }}

        void createAnchorRenameSQLUser(MVEntry mventry, ConnectedMA sqlAnchorRenameUser)
        {
            CSEntry csentry;
            csentry = sqlAnchorRenameUser.Connectors.StartNewConnector("AnchorRenameUser");
            csentry["distinguishedName"].Value = mventry["ADdistinguishedName"].Value;

            try
            {
                csentry.CommitNewConnector();
            }
            catch (System.Exception Ex)
            {
                throw new UnexpectedDataException(Ex.Message);
            }
        }

        void updateAnchorRenameSQLUser(MVEntry mventry, ConnectedMA sqlAnchorRenameUser)
        {
            CSEntry csentry;
            ReferenceValue dn;

            csentry = sqlAnchorRenameUser.Connectors.ByIndex[0];
            dn = sqlAnchorRenameUser.EscapeDNComponent(mventry["ADdistinguishedName"].Value);

            // Check to see if the distinguishedName flowing from AD has changed...
            if (mventry["ADdistinguishedName"].Value.ToLower() != mventry["isRenamed"].Value.ToLower())
            {
                // disconnect the old object.
                csentry.Deprovision();

                //Now provision new connector
                createAnchorRenameSQLUser(mventry, sqlAnchorRenameUser);

            }

        }

But it throws errors. Not working :(

Can something like this be done with FIM for SQL ? it seems from all I have read over the internet FIM will not allow renaming the anchor for SQL. so the other thing people have recommended is to delete the record and recreate it in SQL. Which will work for me but I'm struggling to configure FIM to do it. Please help.

Thank you. GT

0

There are 0 answers