Forum Discussion
EdPriest
Sep 16, 2022Copper Contributor
Notifications for AAD user phone number changes
Our organization would like to setup some system for notifications when a user changes their phone #. When phone #'s are changed in AAD, they need to be updated in another system we have. Any recom...
Jonhed
Sep 17, 2022Steel Contributor
If you export your AAD Audit logs to a Log Analytics workspace, you can run the query below to get the information you want. (It will pickup changes both to workplace numbers as well as mobile numbers)
AuditLogs
| where OperationName == "Update user"
| where TargetResources contains "Mobile" or TargetResources contains "TelephoneNumber"
| mv-expand TargetResources
| extend Changes = parse_json(TargetResources.modifiedProperties)
| mv-expand Changes
| where Changes.displayName in ("Mobile","TelephoneNumber")
| project TimeGenerated,
UPN = TargetResources.userPrincipalName,
ChangedNumber = Changes.displayName,
Old = parse_json(tostring(Changes.oldValue))[0],
New = parse_json(tostring(Changes.newValue))[0]
| sort by TimeGenerated asc
Output Image:
The audit logs only contain the UPN/user GUID, so if you require a readable name(surname/firstname), you could query that from AAD.
Personally I would probably run this in a Azure Logic App or Power Automate on a schedule, daily or hourly depending on the required timeframe. Both email notifications and teams notifications are possible.