Monitor quota used vs. quota assigned in the MS365 sensor
As a PRTG user I would like to be able to monitor if a mailbox is getting to it’s assigned limit. This would help me prevent outages because if full mailboxes.
Data might be available via the Graph API.

There are too many specifics and use cases around this. Is this across the origanization or a single user. You can build a custom sensor approach for this one. Here are the details.
Proactively Monitor Microsoft 365 Mailbox Quotas with PRTG to Prevent Outages
Stay ahead of mailbox capacity issues and prevent disruptive service outages by leveraging the power of the Microsoft Graph API and custom PRTG sensors. This guide will walk you through the process of monitoring individual mailbox usage against their assigned quotas, providing you with the visibility needed to take preemptive action.
Microsoft 365 administrators can now transition from reactive responses to proactive management of mailbox storage. By closely tracking the percentage of used storage against the assigned quota for each user, you can identify mailboxes nearing their limit and intervene before users are unable to send or receive emails. This is achievable through a combination of the Microsoft Graph API, which provides detailed mailbox usage data, and a custom sensor within your existing PRTG Network Monitor setup.
Unlocking Mailbox Quota Data with the Microsoft Graph API
The key to this monitoring solution lies within the Microsoft Graph API, specifically the getMailboxUsageDetail report. This powerful reporting tool provides a comprehensive breakdown of mailbox statistics, including the crucial data points for our purpose:
- Storage Used (Byte): The current size of a user's mailbox.
- Issue Warning Quota (Byte): The storage limit at which a user will receive a warning notification.
- Prohibit Send Quota (Byte): The storage limit at which a user will be prevented from sending new emails.
- Prohibit Send/Receive Quota (Byte): The hard limit at which a user can no longer send or receive emails.
To access this data, you will need to make a GET request to the following Graph API endpoint:
https://graph.microsoft.com/v1.0/reports/getMailboxUsageDetail(period='D7')The period parameter can be set to 'D7', 'D30', 'D90', or 'D180' to retrieve data over different timeframes. The response from this endpoint is a CSV file containing the detailed mailbox usage statistics for all users in your tenant.
Essential Permissions for Graph API Access
To authorize your monitoring script to access this data, you will need to create an application registration in Azure Active Directory and grant it the necessary API permissions. The required permission for accessing the getMailboxUsageDetail report is:
- Reports.Read.All
This permission can be granted for either delegated or application-level authentication, depending on your security policies and scripting approach.
Integrating with PRTG: The Custom Sensor Approach
While PRTG offers a built-in "Microsoft 365 Mailbox Sensor," its functionality is primarily focused on monitoring email counts and age rather than storage quotas. Therefore, a custom sensor is the recommended and most effective solution for this specific monitoring need.
You can create a custom PRTG sensor using a PowerShell script. This script will be responsible for:
- Authenticating with the Microsoft Graph API: Using the credentials of your Azure AD application registration.
- Making the GET request to the getMailboxUsageDetail endpoint.
- Parsing the returned CSV data.
- Identifying specific mailboxes to monitor.
- Calculating the percentage of used storage against the "Prohibit Send/Receive Quota".
- Returning the results to PRTG in the required format.
Step-by-Step Guide to Creating a Custom PRTG Sensor for Mailbox Quotas
Here is a high-level overview of the steps involved in setting up your custom monitoring solution:
1. Create an Azure AD App Registration:
- In the Azure portal, navigate to Azure Active Directory > App registrations > New registration.
- Give your application a descriptive name, such as "PRTG Mailbox Quota Monitor."
- Under "Supported account types," select the option that best suits your organization's needs.
- You do not need to configure a Redirect URI for this script-based approach.
- Once created, take note of the Application (client) ID and Directory (tenant) ID.
- Under Certificates & secrets, create a new client secret and securely store its value.
2. Grant API Permissions:
- In your newly created app registration, go to API permissions > Add a permission.
- Select Microsoft Graph and then choose Application permissions.
- Search for and select Reports.Read.All.
- Click Add permissions.
- Finally, click on Grant admin consent for [Your Tenant Name].
3. Develop the PowerShell Script:
- Create a new PowerShell script (.ps1) that will be executed by your PRTG custom sensor.
- This script will need to handle authentication with the Graph API using the stored credentials.
- It will then call the getMailboxUsageDetail endpoint and process the CSV data.
- The script should be designed to accept the user principal name (UPN) of the mailbox to monitor as a parameter.
- For the specified mailbox, it will calculate the used storage percentage.
- The script must output the result in a format that PRTG can understand (e.g., value:message). For example: 85:Mailbox usage is at 85%.
4. Configure the Custom Sensor in PRTG:
- Place your PowerShell script in the C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML folder on your PRTG probe server.
- In the PRTG web interface, add a new device or select an existing one where you want to add the sensor.
- Choose Add Sensor and select the EXE/Script Advanced sensor type.
- Give the sensor a descriptive name, such as "Mailbox Quota - [email protected]."
- From the EXE/Script dropdown, select your PowerShell script.
- In the Parameters field, pass the UPN of the mailbox you wish to monitor.
- Configure the scanning interval and other sensor settings as needed.
- Set thresholds for "Warning" and "Down" states based on the returned percentage value to trigger alerts.
By following these steps, you will have a robust and automated system for monitoring Microsoft 365 mailbox quotas directly within your PRTG environment. This proactive approach will empower you to prevent service disruptions and ensure a seamless email experience for your users.