Skip to main content
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();


                   
                    }

  • Mea_ Profile Picture
    60,278 on at
    RE: Issue) Active Directory Group in on-premise

    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

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Laurens vd Tang Profile Picture

Laurens vd Tang 171 Super User 2025 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 140 Super User 2025 Season 1

#3
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 127 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans