How do i get data on the use (last login time probably) of mobile devices by users in an AAD security group?

Gareth 0 Reputation points
2024-03-20T14:56:21.1333333+00:00

I have been asked to produce a report for a department in my organisation. They specifically want to know how many users are actively logging onto AAD enrolled devices in order to better use their scarce supply of mobile devices. How do I obtain this data?

All the users are a member of an Azure Security group with assigned membership. I don't have a Power BI licence.

Can anyone help?

Many thanks

Microsoft Entra
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Navya 13,460 Reputation points Microsoft Vendor
    2024-03-21T09:05:54.6+00:00

    Hi @Gareth

    Thank you for posting this in Microsoft Q&A.

    I understand you want get data on the use (last login time probably) of mobile devices by users in an AAD.

    You can get this information via PowerShell. To work with sign-in logs in AAD you required at least one of the below highlighted roles.

    User's image To obtain Azure Active Directory sign-in logs using this Get-AzureADAuditSignInLogs cmdlet.

    Below is the Sample PowerShell code.

    $userfile = Import-Csv -Path "Path\to\your\file.csv" 
    $auditLogs = @()
    foreach ($User in $userfile) {
        $auditLog = Get-AzureADAuditSignInLogs -Filter "UserPrincipalName eq '$User'" | `
                    Select-Object  UserPrincipalName, IsInteractive, @{Name = 'DeviceOS'; Expression = {$_.DeviceDetail.OperatingSystem}},@{Name = 'Last login time'; Expression = {$_.SignInActivity.LastSignInDateTime}}
        $auditLogs += $auditLog
    }
    $auditLogs | Export-Csv -Path "Path\to\output\file.csv" -NoTypeInformation
    
    
    
    

    Please do correct me if this is not the case by responding in the comments section.

    Thanks,

    Navya.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.