web
You’re offline. This is a read only version of the page.
close
Skip to main content
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 182

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
    296,568 Super User 2025 Season 2 on at
    RE: Check if the user is disable in Azure Active Directory

    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.

  • Rafael Araujo Profile Picture
    182 on at
    RE: Check if the user is disable in Azure Active Directory

    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
    296,568 Super User 2025 Season 2 on at
    RE: Check if the user is disable in Azure Active Directory

    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.

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

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans