check that mfa is enabled for a user using restapi

This is possible with MS Graph API,

To Get information of users registered with MFA and hasn’t, we can use isMfaRegistered property in credentialUserRegistrationDetails .

credentialUserRegistrationDetails help us to get the details of the usage of self-service password reset and multi-factor authentication (MFA) for all registered users. Details include user information, status of registration, and the authentication method used. This is possible programmatically with MS Graph where you will get a JSON reports an can be plugged into other reports or can be represented programmatically itself

Example:

GET https://graph.microsoft.com/beta/reports/credentialUserRegistrationDetails

sample output:

{
            "id": "****************************",
            "userPrincipalName": "[email protected]",
            "userDisplayName": "Nishant Singh",
            "isRegistered": false,
            "isEnabled": true,
            "isCapable": false,
            "isMfaRegistered": true,
            "authMethods": [
                "mobilePhone"
            ]
        }

Sample code for your Node JS,

const options = {
    authProvider,
};

const client = Client.init(options);

let res = await client.api('/reports/credentialUserRegistrationDetails')
    .version('beta')
    .get();

To implement your NodeJS code please go through step-by-step guide in MS Documentation

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top