Query Details

Visualization Accounts Longest Period Without Password Reset

Query

# Visualise Time Of Last Password Reset

## Query Information

#### Description
Visualise the time of which a password reset has last taken place, the information is grouped in buckets of 10 days. While password expiration requirements do more harm than good it is still recommended to take a look at the accounts from which the password has not changed for years. This is due to the changes in the password policy, if the policy has been changed after the latest password change of that account is it likely that the account does not adhere to the currenct password policy. Every next password policy is in most cases an improvement, therefore it is expected that accounts that have not changed their password after the latest policy update do not meet the current complexity requirements.

#### Risk
If a password has not been changed for years, it might be that the account does not adhere to the current password policy. This can have potential impact, since the password complexity is most likely weaker then expected.

#### References
- https://learn.microsoft.com/en-us/microsoft-365/admin/misc/password-policy-recommendations?view=o365-worldwide

## Defender For Endpoint
```
AADSignInEventsBeta
| where Timestamp > ago(30d)
// Collect the last event for each account
| summarize arg_max(Timestamp, *) by AccountObjectId
| where isnotempty(LastPasswordChangeTimestamp)
// Calculate the period between now and the last password change
| extend DaysSinceLastPasswordChange = datetime_diff('day', now(), LastPasswordChangeTimestamp)
// put the results into bins of 10 days
| summarize TotalAccounts = count() by  bin(DaysSinceLastPasswordChange, 10)
| sort by DaysSinceLastPasswordChange asc
| render columnchart with(xtitle="Days since last password change", ytitle="Total accounts")
```

Explanation

This query visualizes the time of the last password reset for user accounts. The information is grouped into buckets of 10 days. It is important to check accounts that have not changed their password for years because they may not adhere to the current password policy, which could weaken the password complexity. The query calculates the number of accounts that have not changed their password within certain time intervals and displays the results in a column chart.

Details

Bert-Jan Pals profile picture

Bert-Jan Pals

Released: September 27, 2023

Tables

AADSignInEventsBeta

Keywords

Devices,Intune,User

Operators

wheresummarizearg_maxbyisnotemptyextenddatetime_diffnowbincountsortrender

Actions