Created
February 22, 2023 05:05
-
-
Save rbrayb/c132568d7ecedb67c43a5119e75631cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the Azure AD B2C tenant name and endpoint | |
$tenantName = "tenantname" | |
# Connect to Azure AD B2C | |
Connect-AzureAD -Tenant "$tenantName.onmicrosoft.com" | |
# Import the Excel spreadsheet as a PowerShell object | |
$excelFilePath = "C:\...\Downloads\AuditLogs_2023–02–22.xlsx" | |
$worksheetName = "AuditLogs_2023–02–22" | |
$excelData = Import-Excel -Path $excelFilePath -WorksheetName $worksheetName | |
# Loop through each row of the spreadsheet | |
foreach ($row in $excelData) { | |
# Get the Object ID from the current row | |
$objectId = $row.Target1ObjectId | |
# Use the Azure AD PowerShell module to get the user's username | |
$user = Get-AzureADUser -ObjectId $objectId | Select DisplayName | |
# Output the username to the console | |
Write-Host "Username: $user" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://medium.com/the-new-control-plane/getting-a-list-of-users-who-have-reset-their-passwords-in-azure-ad-b2c-21d74fda3060