'Getting passwordPolicies as null always in Microsoft graph API 1.0

I'm Using Microsoft Graph API Version 1.0

I need to fetch the password expiry time configured in the Azure Active Directory for users using the graph API.

I'm used the https://developer.microsoft.com/en-us/graph/graph-explorer.

In the admin.microsoft.com the configured value is 14 days for password expiry. But, Graph API returns null value. But if we configure the password as never expires, Graph API is returning as DisablePasswordExpiration

The API I have requested in Graph Explorer is

GET https://graph.microsoft.com/v1.0/me?$select=passwordPolicies


Solution 1:[1]

There is no way how to get password validity period from Graph API.

What you can read is the time when the users last changed their password or when their password was created.

You need to call beta API.

GET https://graph.microsoft.com/beta/me?$select=lastPasswordChangeDateTime

Response

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#users(lastPasswordChangeDateTime)/$entity",
    "lastPasswordChangeDateTime": "2022-05-10T10:31:55Z"
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user2250152