Modern Workplace Automation: Updated M365 License & Entra Roles Reporting Scripts

Listen to this Post

Featured Image
Roy Klooster has released updated versions of two PowerShell scripts designed for Microsoft 365 (M365) license assignment and Entra admin roles reporting. These scripts now feature enhanced automation capabilities, including multiple authentication methods and email integration for seamless reporting.

Key Updates:

1. `Generate-M365LicenseAssignmentReport`

  • Supports client secret, certificate, managed identity, and access token for secure automated pipelines.
  • New email feature (-SendMail, -Recipient, -From).

2. `Generate-EntraAdminRolesReport`

  • Now includes email functionality for automated report distribution.

How to Update the Scripts

Run these PowerShell commands to update:

Update-Script Generate-M365LicenseAssignmentReport -Force 
Update-Script Generate-EntraAdminRolesReport -Force 

You Should Know:

PowerShell Automation for M365 Reporting

  • Check installed scripts:
    Get-InstalledScript 
    
  • Run the license report with email:
    Generate-M365LicenseAssignmentReport -SendMail -Recipient "[email protected]" -From "[email protected]" 
    
  • Export report to CSV:
    Generate-EntraAdminRolesReport | Export-Csv -Path "EntraRolesReport.csv" -NoTypeInformation 
    

Linux Alternative (If Using Azure CLI)

  • Authenticate Azure:
    az login --service-principal -u <app-id> -p <client-secret> --tenant <tenant-id> 
    
  • Get M365 license info via REST API:
    curl -X GET -H "Authorization: Bearer $(az account get-access-token --query accessToken -o tsv)" \ 
    "https://graph.microsoft.com/v1.0/subscribedSkus" 
    

Windows Admin Tips

  • Schedule reports with Task Scheduler:
    $action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-File C:\Scripts\Generate-M365LicenseAssignmentReport.ps1" 
    $trigger = New-ScheduledTaskTrigger -Daily -At 3am 
    Register-ScheduledTask -TaskName "M365LicenseReport" -Action $action -Trigger $trigger 
    

What Undercode Say

Automating M365 license and role reporting reduces manual overhead and enhances security compliance. By integrating email notifications and supporting multiple authentication methods, these scripts are now more enterprise-ready. Future enhancements could include Slack/Teams webhook notifications and automated remediation for misassigned licenses.

Expected Output:

  • Updated PowerShell scripts with email support.
  • Automated CSV reports for M365 licenses and Entra roles.
  • Secure authentication via certificates, managed identities, and client secrets.

Relevant URLs:

Prediction

As cloud environments grow, AI-driven license optimization and automated role-based access control (RBAC) audits will become standard in enterprise IT automation. Expect deeper Azure Logic Apps and Power Automate integrations in future script updates.

References:

Reported By: Roy Klooster – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 Telegram