Forum Discussion

lfk73's avatar
lfk73
Brass Contributor
Oct 01, 2024

Export Enterprise apps and signin count

I need to export all the configured enterprise apps and login count for each.  This script does the job, but it truncates the application name (see example screen shot) and I can't figure out how to export the results to csv.  Can anyone help?

 

#To enable verbose

[CmdletBinding()]

Param()

#Retrieve list of applications

$Apps = Get-AzureADApplication

#Loop through each application

ForEach($App in $Apps){

Write-Verbose "Processing $($App.DisplayName)"

#Retrieve logs filtered on AppID

$Log = Get-AzureADAuditSignInLogs -All $true -filter "appid eq '$($App.AppID)'"

#Create a custom object for output

[PSCustomObject]@{

ApplicationName = $App.DisplayName

ApplicationID = $App.AppID

SignIns = $Log.count


}

#To prevent throttling on Sign-in Log querying, insert a sleep

Start-Sleep 1

}

Resources