Comments on: Using the Microsoft SDK for PowerShell to Report Azure AD Account Sign-ins https://practical365.com/using-microsoft-sdk-powershell-report-azure-ad-account-sign-ins/ Practical Office 365 News, Tips, and Tutorials Mon, 06 Jun 2022 16:21:14 +0000 hourly 1 https://wordpress.org/?v=6.3.2 By: Fernando Gualano https://practical365.com/using-microsoft-sdk-powershell-report-azure-ad-account-sign-ins/#comment-238756 Mon, 06 Jun 2022 16:21:14 +0000 https://practical365.com/?p=53752#comment-238756 In reply to Tony Redmond.

Thank you Tony!! šŸ˜‰

]]>
By: Tony Redmond https://practical365.com/using-microsoft-sdk-powershell-report-azure-ad-account-sign-ins/#comment-238751 Mon, 06 Jun 2022 14:29:44 +0000 https://practical365.com/?p=53752#comment-238751 In reply to Fernando Gualano.

The Status gives a value like this:

$lastsignin.status

AdditionalDetails ErrorCode FailureReason
—————– ——— ————-
MFA requirement satisfied by claim in the token 0 Other.

I think you’ll have to interpret the ErrorCode and output a value like Success, Failed, or Interrupted depending on its value.

]]>
By: Fernando Gualano https://practical365.com/using-microsoft-sdk-powershell-report-azure-ad-account-sign-ins/#comment-238750 Mon, 06 Jun 2022 14:23:59 +0000 https://practical365.com/?p=53752#comment-238750 Thanks Tony! Great Post! šŸ™‚
Iā€™d like to know how can I add the “Status” (Success | Failed | Interrupted) to the script. This is displayed in the “Basic info” tab of each Sign In Log:

Date: xxx
Request ID: xxx-xxx-xxx-xxx-xxx
Correlation ID: xxx-xxx-xxx-xxx-xxx
Authentication requirement :xxx
Status: Success
Continuous access evaluation: No

Even though the Get-MgAuditLogSignIn cmdlet returned the “Status”, I only see the errorCode, failureReason and additionalDetails fields and none of them returned the actual status (Success | Failed | Interrupted).

Is it possible to return the Status of each Sign In the same way I get it from the Azure Sign In Logs portal?

Thanks!

]]>
By: Tony Redmond https://practical365.com/using-microsoft-sdk-powershell-report-azure-ad-account-sign-ins/#comment-238635 Thu, 26 May 2022 23:55:59 +0000 https://practical365.com/?p=53752#comment-238635 In reply to Elbert Santos.

The location for the sign-in is returned in

$lastSignIn.Location

City CountryOrRegion State
—- ————— —–
Dublin IE Dublin

Add whatever property you want to the set included in the report and the job is done.

]]>
By: Elbert Santos https://practical365.com/using-microsoft-sdk-powershell-report-azure-ad-account-sign-ins/#comment-238634 Thu, 26 May 2022 23:00:44 +0000 https://practical365.com/?p=53752#comment-238634 Hi,

Thank you for the amazing work.

I’d like to know how can I add the Location to the script.

]]>
By: Tony Redmond https://practical365.com/using-microsoft-sdk-powershell-report-azure-ad-account-sign-ins/#comment-236941 Tue, 26 Oct 2021 16:19:32 +0000 https://practical365.com/?p=53752#comment-236941 In reply to Carl Knecht.

I’m not sure the API supports retrieval for non-interactive sign-ins. At least, I haven’t seen any documentation to that effect. It looks as if the Get-MgAuditLogSignin cmdlet requires a user id https://docs.microsoft.com/en-us/powershell/module/microsoft.graph.reports/get-mgauditlogsignin?view=graph-powershell-beta

]]>
By: Carl Knecht https://practical365.com/using-microsoft-sdk-powershell-report-azure-ad-account-sign-ins/#comment-236940 Tue, 26 Oct 2021 16:14:18 +0000 https://practical365.com/?p=53752#comment-236940 Looks like this only captures interactive user sign-ins. Are you aware of any method to capture non-interactive user sign-ins as well?

]]>
By: Tony Redmond https://practical365.com/using-microsoft-sdk-powershell-report-azure-ad-account-sign-ins/#comment-236935 Tue, 26 Oct 2021 15:31:29 +0000 https://practical365.com/?p=53752#comment-236935 In reply to Ariel.

[array]$LastSignIn = Get-MgAuditLogSignIn -Filter “UserId eq ‘$($User.Id)'” -Top 1

Looking at $LastSignIn.AdditionalProperties[“uniqueTokenIdentifier”], I think you’ll see a token if modern authentication. It’s kind of hard for me to know because none of the clients in my tenant use basic authentication.

]]>
By: Ariel https://practical365.com/using-microsoft-sdk-powershell-report-azure-ad-account-sign-ins/#comment-236934 Tue, 26 Oct 2021 15:24:39 +0000 https://practical365.com/?p=53752#comment-236934 Which attribute should I look for if I want to know if that specific entry or sign in used TLS 1.0/1.1?

]]>