1

(To be clear, this is not a question about setting up SSO, although setting up Identity Connect or similar for our Salesforce environment would probably be a prerequisite to what I want to do.)

Basically, we have a service we sell that authenticates against our Active Directory. Let's call them widgets, for simplicity's sake. We're using Salesforce as our CRM, and have created a custom object for these widget logins. Currently, when a customer orders a new widget, someone enters that data into Salesforce, and then kicks the request over to IT to create the account in Active Directory (and other places). It's an inefficient process, and I'd like to automate it, ideally, by having a Salesforce form/process/workflow that would create an appropriate account in Active Directory based on the custom widget object.

Is this possible? And if so, what would I need, broadly speaking, to make this happnen?

1

Directly, I do not think it is possible, however, you could create a rest API within your network to create the users and whatever else you need and then upon the appropriate event happening in SF call that API and have the user created...

Some sample code to use to create a user using .net

public string CreateUserAccount(string ldapPath, string userName, 
    string userPassword)
{
    try
    {
        string oGUID = string.Empty;
        string connectionPrefix = "LDAP://" + ldapPath;
        DirectoryEntry dirEntry = new DirectoryEntry(connectionPrefix);
        DirectoryEntry newUser = dirEntry.Children.Add
            ("CN=" + userName, "user");
        newUser.Properties["samAccountName"].Value = userName;
        newUser.CommitChanges();
        oGUID = newUser.Guid.ToString();

        newUser.Invoke("SetPassword", new object[] { userPassword });
        newUser.CommitChanges();
        dirEntry.Close();
        newUser.Close();
    }
    catch (System.DirectoryServices.DirectoryServicesCOMException E)
    {
        //DoSomethingwith --> E.Message.ToString();

    }
    return oGUID;
}

Taken from here:

https://www.codeproject.com/articles/18102/howto-almost-everything-in-active-directory-via-c

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.