Managing a Microsoft 365 environment can be challenging, especially when dealing with user accounts. Ensuring proper visibility into recently deleted users can save time and protect your organization from potential risks. That’s where our Recently Deleted Users tool steps in to simplify the process.
In Microsoft 365, a “recently deleted user” refers to a user account that has been removed from the tenant within a specific retention period. By default, deleted user accounts are retained in the Azure Active Directory Recycle Bin for up to 30 days.
When a user is deleted from Microsoft 365, their account enters a "soft delete" state. During this period, the account can be:
Key criteria for identifying recently deleted users include:
Why should you monitor recently deleted users? Here are some compelling reasons:
Microsoft 365 administrators can track recently created users using various methods:
Using Microsoft Entra admin center: You need to do the following:
Using PowerShell Scripts: With the Microsoft Graph PowerShell module, you can query recently deleted users programmatically.
# Ensure the Microsoft.Graph module is installed and imported
Install-Module -Name Microsoft.Graph -Force -AllowClobber
Import-Module Microsoft.Graph
# Connect to Microsoft Graph
Connect-MgGraph -Scopes "User.Read.All"
# Define the date range for fetching deleted users (customize as needed)
$startDateTime = (Get-Date).AddDays(-30).ToString("yyyy-MM-ddTHH:mm:ssZ") # Past 30 days
# Fetch all DirectoryAudit logs in the past 30 days (without filter for 'Delete User')
$allAuditLogs = Get-MgAuditLogDirectoryAudit -Filter "activityDateTime ge $startDateTime"
# Create an array to store the formatted results
$deletedUserDetails = @()
# Loop through the audit logs to find 'Delete User' events
foreach ($event in $allAuditLogs) {
if ($event.ActivityDisplayName -eq 'Delete User') {
$deletedTime = $event.ActivityDateTime
$deletedUser = ($event.TargetResources | Where-Object { $_.UserPrincipalName }).UserPrincipalName
$deletedBy = $event.InitiatedBy.User.UserPrincipalName
$resultStatus = if ($event.Result -eq 'success') { 'Success' } else { 'Failed' }
# Create an object for each record
$userDetail = [pscustomobject]@{
"Deleted Time" = $deletedTime
"Deleted User" = $deletedUser
"Deleted By" = $deletedBy
"Result Status" = $resultStatus
}
# Add the object to the results array
$deletedUserDetails += $userDetail
}
}
# Output the results in a tabular format
if ($deletedUserDetails.Count -eq 0) {
Write-Host "No deleted user events found in the given date range."
} else {
$deletedUserDetails | Format-Table -AutoSize
}
Although powerful, using PowerShell requires expertise, and the output lacks advanced reporting or filter-based functionalities.
To overcome these limitations, we’re thrilled to introduce the Recently Deleted Users Tool — a robust solution designed to simplify the tracking and management of recently deleted users.
Key Features:
Unlike traditional PowerShell scripts or admin center reports, this tool simplifies the process, enabling administrators of all skill levels to gain actionable insights in minutes.
Tracking deleted users has never been easier! With our Recently Deleted Users Tool, you gain complete control over user account deletions in your Microsoft 365 environment. Say goodbye to tedious log filtering and scripting—our tool provides everything you need, right at your fingertips.
👉 Try our free Microsoft 365 Recently Deleted Users Tool today to track user account deletion and ensure your tenant stays efficient and secure!
Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.
Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.
© Your Site Name. All Rights Reserved. Design by HTML Codex