Project Owner: Jannos-443
PRTG Powershell Script to monitor Microsoft 365 license usage
Free and open source: MIT License
Features
- Microsoft 365 License usage
- Last Azure AD Sync
- Group Based Licensing Error
V1.0
- Added FriendlyName Feature
- Added Ability to use HTTP Push to avoid local Permission on critical Remote Servers (Backup etc.)
V1.01
- fixed free license count (issue #6)
-
Place
PRTG-M365-Licenses.ps1
underC:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML
-
Create AzureAD App
- Open Azure AD
- Register new APP
- Overview >> Get Application ID
- Set API Permissions >> MS Graph >> Application >>
- Organization.Read.All
- Group.Read.All
- Certificates & secrets >> new Secret or follow this Guide: Paessler M365 Credentials
-
Create new Sensor
- EXE/Script Advanced =
PRTG-M365-Licenses.ps1
- Parameter =
-ApplicationID 'Test-APPID' -TenantID 'YourTenantID' -AccessSecret 'Test-AppSecret' -SKUPattern '^(Enterprisepack|EMS|ATP_ENTERPRISE)$'
- EXE/Script Advanced =
-
Set your own Channel limits if needed
Show all Lics with at least 1 License
-ApplicationID 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' -TenantID 'YourTenantID' -AccessSecret 'YourSecretKey'
Include Enterprisepack, EMS, ATP, VISIO, PROJECT and DYNAMICS Licenses
... -IncludeSKU '(Enterprisepack|EMS|ATP_ENTERPRISE|VISIOCLIENT|PROJECTPROFESSIONAL|DYN365_ENTERPRISE_SALES|DYN365_TEAM_MEMBERS|D365_CUSTOMER_SERVICE_ENT_ATTACH)'
Include only "O365 E3" (Enterprisepack) and "EMS" (EMS)
... -IncludeSKU '^(Enterprisepack|EMS|ATP_ENTERPRISE)$'
Include all but "O365 E3" (Enterprisepack) and "EMS" (EMS)
... -ExcludeSKU '^(Enterprisepack|EMS|ATP_ENTERPRISE)$' -exclude
Use FriendlyNames for ChannelNames
-ApplicationID 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' -TenantID 'YourTenantID' -AccessSecret 'YourSecretKey' -FriendlyName
Include only "Office 365 E3"
... -FriendlyName -IncludeName '^(Office 365 E3)$'
Exclude "Office 365 E3"
... -FriendlyName -ExcludeName '^(Office 365 E3)$'
For more information about the different SKUs, visit Microsoft Docs. String ID for SKU (IncludeSKU) Product name for Name (IncludeName)
You can use the variables to exclude/include The variables take a regular expression as input to provide maximum flexibility.
For more information about regular expressions in PowerShell, visit Microsoft Docs.
".+" is one or more charakters ".*" is zero or more charakters