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 :
Finance | Project Operations, Human Resources, ...
Unanswered

Check if the user is disable in Azure Active Directory

(0) ShareShare
ReportReport
Posted on by 183

I did a batch job to disable the users, in Dynamics AX 2012 R3, when these are disabled in local Active Directory. Is it possible to do it in Dynamics 365 FinOps with Azure AD?

I have used the code below to do it by job.

static void disableUsersMissingInAD(Args _args)
{
    UserInfo                userInfoUpdate;
    xAxaptaUserManager      xAxaptaUserManager;
    xAxaptaUserDetails      xAxaptaUserDetails;
    #Guest
    
    xAxaptaUserManager = new xAxaptaUserManager();

    Global::startLengthyOperation();
    ttsbegin;

    while select forUpdate userInfoUpdate
    order by networkAlias
    where userInfoUpdate.Id != #GuestUser
       && userInfoUpdate.enable == 1
    {
        // Get the single user's details from the kernel class
        xAxaptaUserDetails = xAxaptaUserManager.getDomainUser(userInfoUpdate.NetworkDomain, userInfoUpdate.NetworkAlias);

        // Only show users who are enabled in Active Directory
        if (xAxaptaUserDetails == null || xAxaptaUserDetails.getUserCount() == 0 || !xAxaptaUserDetails.isUserEnabled(0))
        {
            userInfoUpdate.enable = 0;
            userInfoUpdate.update();
        }
    }

    ttscommit;
    Global::endLengthyOperation();
}

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,030 Super User 2025 Season 2 on at

    Hi Rafael,

    It is possible to do this. We have a security and compliance solution where it is one of the features.

    Dynamics 365 also has a new report which could show the dormant users. You can then get a list of users not having used the system for e.g. 60 days.

  • Rafael Araujo Profile Picture
    183 on at

    Hi André,

    In AX solution we have the option to set the maximum days without access the system (default is 60 days) and I want to do the same in D365. 60 days without access the AX or disable in AD.

  • André Arnaud de Calavon Profile Picture
    301,030 Super User 2025 Season 2 on at

    Hi Rafael,

    The standard Dormant users report is only showing these users. If you need to disable them automatically, then you have to consider creating a customization again or go for an ISV solution.

    How to interact with Azure AD? There is an example on the Users form for importing users from Azure AD.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans