web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Unanswered

Issue) Active Directory Group in on-premise

(0) ShareShare
ReportReport
Posted on by 350

I created a class that brings users by AD GROUP.

I made it using standard class and source.

This class works well in a cloud environment. (Azure Active Directory & Group)

But, not work in the on-premise environment. (Active Directory & Group)

In an on-premise environment, please let me know how to find AD Group by user email. (x++ code)

my class

// get user list

 var directoryClient = SysUserMSODSImportHelper::getActiveDirectoryClientWithDomain(TrustedDomainsControl.text());
      
        try
        {


            if (!displayNameText && !aliasNameText && !firstNameText && !lastNameText && !titleText && !companyText && !departmentText)
            {
             
                directoryUsersEnumerator = directoryClient.ListUsers().GetEnumerator();
            }
            else
            {
                
                directoryUsersEnumerator = directoryClient.ListUsersWithFilter(displayNameText, aliasNameText, firstNameText, lastNameText, titleText, companyText, departmentText).GetEnumerator();
            }
        }

.

.

 while(directoryUsersEnumerator.MoveNext())
            {
                user = directoryUsersEnumerator.Current;
                existsSecurityGr = false;
                
                SysUserMSODSUserTmp tmp;

                if (!isGraphAPI)
                {
                    
                    // skip importing the user does not have UserPrincipalName.
                    if (strLen(user.UserPrincipalName) == 0)
                    {
                        
                        continue;
                    }
                }

                if (strScan(user.UserPrincipalName, '#EXT#', 1, strLen(user.UserPrincipalName)) == 0)
                {
               
                    tmp.NetworkAlias = user.UserPrincipalName;
                    tmp.NetworkDomain = Microsoft.Dynamics.ApplicationPlatform.Environment.EnvironmentFactory::GetApplicationEnvironment().get_Provisioning().get_AdminIdentityProvider();
                   
                }

----------------------------------------------------------------------

// get Group

 SysActiveDirectoryGroupTmp  _groupTmp;
                    Microsoft.Dynamics.AX.Security.DirectoryHelper.Group adgroup;
                    System.Collections.IEnumerator ListSecurityGroup;
                    ListSecurityGroup =                 directoryClient_SecurityGr.ListSecurityGroups().GetEnumerator();
                    Info("s39");
                    while ( ListSecurityGroup.MoveNext() )
                    {
                        adgroup = ListSecurityGroup.Current;
                        Info("s40");                   
                        _groupTmp.Name = adgroup.DisplayName; // Users 
                        _groupTmp.ObjectId = adgroup.ObjectID.ToString(); // 23b77b7d-f25c-4ccb-88c5-a30a1ad393a5
                        warning(strFmt("adgroup : %1, %2, %3, %4", tmp.NetworkAlias, _groupTmp.AxUserID, _groupTmp.Name, _groupTmp.ObjectId));
                        _groupTmp.insert();


                   
                    }

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at

    Out of the box you should be able to import groups and FnO will automatically allow users in that group to access the system, here is a blog post that talks about it dynamicspedia.com/.../

    So why do you need your customization ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Laurens vd Tang Profile Picture

Laurens vd Tang 301 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 118 Super User 2025 Season 2

#3
Siv Sagar Profile Picture

Siv Sagar 105 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans