question

SheshankDhoot-2954 avatar image
0 Votes"
SheshankDhoot-2954 asked SheshankDhoot-2954 commented

Azure AD : Need powershell script to fetch Azure AD User Sign-in date and time (Last logon)

On Premise AD does not update the Azure AD Sign-in Logs and O365 User Activity report does not include the interactive sign in performed by users.
Need PowerShell script to fetch each Azure AD user Sign-in logs, trying to reconcile the On-premise users last login data with Azure AD Sign-in activity to find inactive users.

Get-MSolUser and Get-AzureAdUser does not include the required data and the details are required for unlicensed users also.

Assuming Inactive users to be the one who have not signed-in in last 90 days.

windows-server-powershellazure-ad-domain-servicesazure-ad-sign-in-logs
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SheshankDhoot-2954 ,

did the answer work for you? Are there any additional questions to this topic?

If you found the answer helpful, it would be great if you please mark it "Accept as answer". This will help others to find answers in Q&A

----------
Regards
Andreas Baumgarten

0 Votes 0 ·
AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered SheshankDhoot-2954 commented
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I need sign-in details of each user from Azure AD and the reason is if user account is not used for logon on any on-premise domain joined machine then it will not populate last logon date and time in AD. There are cases where account is active and is used in O365 and Azure and have latest sign-in dates.

0 Votes 0 ·
LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered SheshankDhoot-2954 commented

Hello,

Thank you for reaching out.

Additionaly,

You can use Get-AzureADAuditSignInLogs powershell command to get user sign in logs from Azure AD.

https://docs.microsoft.com/en-us/powershell/module/azuread/get-azureadauditsigninlogs?view=azureadps-2.0-preview

Hope this helps,

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

These will provide sign-in event logs and will not be per user. Its like if I made 10 sign-in in a day I will retrieve 10 results. I am looking for all user sign-in details hope this helps. Once I will be able to pull all Azure user sign in details then It can be filtered with users who have not logged in in last 90 days and those can be compared with On Premise AD Last logon Report.

0 Votes 0 ·