Report License Assignment Scheduled
Generate and email a license availability report based on thresholds
Description
This runbook checks the license availability based on the transmitted SKUs and sends an email report if any thresholds are reached. Two types of thresholds can be configured. The first type is a minimum threshold, which triggers an alert when the number of available licenses falls below a specified number. The second type is a maximum threshold, which triggers an alert when the number of available licenses exceeds a specified number. The report includes detailed information about licenses that are outside the configured thresholds, exports them to CSV and/or Excel (xlsx) files, and sends them via email. The report files can also be uploaded to an Azure Storage Account, returning time-limited download links. The ReportFileFormat parameter controls which file formats are generated and delivered (CSV only, CSV & XLSX, or XLSX only). When the CSV attachment exceeds the email size limit and "CSV & XLSX" is selected, the email falls back to the Excel workbook alone.
Runbook Customization
Setup regarding email sending
Sending an email report is optional and only happens when a recipient (EmailTo) is provided. The sender address is taken from the RJReport.EmailSender tenant setting.
This runbook sends emails using the Microsoft Graph API. To send emails via Graph API, you need to configure an existing email address in the runbook customization.
See the RealmJoin Report Settings documentation for details.
InputJson Configuration
Each license configuration requires:
SKUPartNumber (required): Microsoft SKU identifier
FriendlyName (required): Display name
MinThreshold (optional): Alert when available licenses < threshold
MaxThreshold (optional): Alert when available licenses > threshold
At least one threshold must be set per license.
Configuration Examples
Minimum threshold only (prevent shortages):
Maximum threshold only (prevent over-provisioning):
Both thresholds (maintain range):
Complete Runbook Customization
Finding SKU Part Numbers
Common SKUs:
ENTERPRISEPACK- Microsoft 365 E3ENTERPRISEPREMIUM- Microsoft 365 E5EMS- Enterprise Mobility + Security E3
Output
When violations detected:
Console output in job log
CSV export (
License_Threshold_Violations.csv)Email report with summary, violations, recommendations, and CSV attachment
When all within thresholds:
No email sent
Job completes successfully
Troubleshooting
SKU Not Found: Verify SKU exists using Get-MgSubscribedSku
Email Not Sent: Check EmailFrom configuration and Mail.Send permission
Invalid JSON: Validate JSON format before configuration
Migration Note
Legacy WarningThreshold automatically maps to MinThreshold - old configurations continue to work.
Location
Organization → General → Report License Assignment (Scheduled)
Full Runbook name
rjgit-org_general_report-license-assignment_scheduled
Permissions
Application permissions
Type: Microsoft Graph
Organization.Read.All
User.Read.All
Mail.Send
Parameters
InputJson
JSON array containing SKU configurations with thresholds. Each entry should include a SKUPartNumber for the Microsoft SKU identifier, a FriendlyName as the display name for the license, an optional MinThreshold specifying the minimum number of licenses that should be available, and an optional MaxThreshold specifying the maximum number of licenses that should be available.
This needs to be configured in the runbook customization
Required
true
Default Value
Type
Object
ReportFileFormat
Controls which report file formats are generated and delivered: "CSV only", "CSV & XLSX" (default) or "XLSX only".
Required
false
Default Value
CSV & XLSX
Type
String
CreateDownloadLink
If enabled, the report files are uploaded to an Azure Storage Account and time-limited download links are returned. Disabled by default.
Required
false
Default Value
False
Type
Boolean
ContainerName
Storage container name used for the upload. Configured per runbook (not a global RJReport setting).
Required
false
Default Value
report-license-assignment
Type
String
ResourceGroupName
Resource group that contains the storage account. Sourced from the RJReport tenant settings.
Required
false
Default Value
Type
String
StorageAccountName
Storage account name used for the upload. Sourced from the RJReport tenant settings.
Required
false
Default Value
Type
String
LinkExpiryDays
Number of days until the generated download link expires. Sourced from the RJReport tenant settings.
Required
false
Default Value
6
Type
Int32
EmailTo
If specified, an email with the report will be sent to the provided address(es). Can be a single address or multiple comma-separated addresses (string).
Required
false
Default Value
Type
String
EmailFrom
Sender email address resolved from settings.
Required
false
Default Value
Type
String
Last updated
Was this helpful?