Data is key! How to Analyze your M365 Usage?

//

Chris van der Zwan

Unlocking Savings: How to Optimize Your Microsoft Agreement

When you want to optimize your license cost you need to understand your current and future use of the technology. 

In other words, “DATA IS KEY!” Data is your golden nugget. 

Most organizations think that they need expensive and fancy tooling. It certainly saves you time, but without an investment in a tool you are able to get your data too. 

In this blog and video, we will show you how to export the M365 usage reports and how to analyze them. 

Data Exports
Before you are able to analyze the data and optimize you licenses we need to make a few data exports out of you Microsoft 365 tenant. 

Which rights do I need? 
For the license and usage information you need to be an admin in the tenant. There are several roles. The role you need for these data insights are Usage Summary Reports Reader, License Admin and Exchange admin.

Please also ask your global admin to uncheck “Display concealed user, group and site names in all reports. 

User and license export

Usage Exports

To analyze the email activity, we go to “Exchange” 

Project / Visio

  • Make an export of the active users dashboard.

Inactive Users
To receive the last login date information to determine the inactive users could be one via PowerShell script.

1. Install the Required PowerShell Module

First, you need to install the AzureAD module if you haven’t already. Open PowerShell as an administrator and run:

Install-Module AzureAD

2. Connect to Azure AD

Next, connect to your Azure AD tenant:

Connect-AzureAD

You’ll be prompted to enter your Microsoft 365 admin credentials.

3. Retrieve Last Login Information

You can use the Get-AzureADAuditSignInLogs cmdlet to get the last login date for users. Here’s a basic script to get the last login date for all users and export it to a CSV file:

# Connect to Microsoft Graph
Connect-MgGraph -Scopes "User.Read.All""AuditLog.Read.All"

# Initialize variables
$nextPage = $true
$requestUrl = "/beta/users?select=userPrincipalName,id,userType,signInActivity&top=100"
$csvFilePath = "C:\temp\UserLogins.csv"

# Loop through paged responses
while ($nextPage) {
Write-Host "." -NoNewline
   # Get the current page of users
   $response = Invoke-MgGraphRequest -Method GET -Uri $requestUrl
   # Select the required properties
   $userLogins = $response.value | Select-Object @{Name="UserPrincipalName";Expression={$_.userPrincipalName}}, 
   
@{Name="Id";Expression={$_.id}}, 
             @{Name="UserType";Expression={$_.userType}}, 

@{Name="LastSignIn";Expression={$_.signInActivity.lastSignInDateTime}}

   # Append the current page of results to the CSV file
   $userLogins | Export-Csv -Path $csvFilePath -NoTypeInformation -Append

   # Check if there is a next page
   if ($response.'@odata.nextLink') {
       $requestUrl = $response.'@odata.nextLink'
   } else {
       $nextPage = $false
   }
}

# Output completion message
Write-Host "Export completed. The data has been written to $csvFilePath."

This script will export the user principal names and their last login dates to a CSV file1.

4. Run the Script

Save the script with a .ps1 extension, for example, Get-LastLoginDates.ps1. To run the script, open PowerShell, navigate to the directory where the script is saved, and execute:

.\Get-LastLoginDates.ps1

How to analyze these reports?
You now have made all the exports and are able to analyze the data. We’ve made a step-by-step approach to analyze the data with the key outcome to optimize your licenses.

  1. User export: 

Here we look for non-user’s accounts. For example, “fabric001” or “MeetingRoomAmsterdam” or Shared Accounts. There are more cost-effective ways to license these kinds of accounts. 

  •  License export: 

Here we look for the delta of the available vs usage licenses. All the unused licenses we could reduce in the contract to save cost. 

  • Usage exports:

We start with the Office apps. In the export you’re able to find per user if they have used the office application. We filter on 90 or 180 days not used. This will give us the potential list of optimizing M365 E3 or Office365 E3 to an E1 of F-type of license. Before we are able to do that, we analyze their email and OneDrive usage. 

Leave a Comment

Contact Us

United Kingdom

Netherlands

South Africa

United States

Singapore

United Arab Emirates