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

Announcements

News and Announcements icon
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,286 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Laurens vd Tang Profile Picture

Laurens vd Tang 88 Super User 2026 Season 1

#2
Sagar Suman Profile Picture

Sagar Suman 72 Super User 2026 Season 1

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 54 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans