Alert on Unused M365 Licenses Crate

If you’re new to Crates, read through our introductory Crate documentation here. Find the Crate in our Crate Marketplace.

What does the Alert on Unused M365 Licenses Crate do?

This Crate checks daily for unused M365 licenses that can be returned to Pax8, then creates a ticket in your PSA with the information. The ticket will include hyperlinks to update the purchased quantity to match the used quantity and remediate unused licenses.

Note that the existence of an SKU in Microsoft doesn’t mean that it was purchased through Pax8. Customers can still buy directly from Microsoft. If a SKU doesn’t have a matching Pax8 subscription, it won’t be alerted on because the automation wouldn’t be able to modify or validate quantities for something that doesn’t exist in Pax8.

How the Crate works

The workflow unpacked with this Crate runs on a cron trigger, and will generate the ticket at the same time each day.

Tickets or alerts are generated only when all of the following is true:

  • The subscription is oversubscribed

  • The commit term is monthly

  • The subscription is not included in the ignored subscriptions list

No action is taken when any of the following is true:

  • The subscription has a yearly commit, even if it's oversubscribed

  • The subscription is in the ignored subscriptions list

  • There's no corresponding Pax8 subscription for that SKU

Workflow breakdown

  1. The workflow begins with the start task which initializes the process by setting the retry count to zero and preparing the workflow for execution.

  2. The check_for_exclusions task examines whether an organization variable exists that contains a list of organizations excluded from the Pax8 license removal process.

  3. If exclusions are found, the exclusions_var_found task checks if the current organization ID is in the exclusion list, and if so, routes to the org_excluded task to terminate processing.

  4. If the organization is not excluded, the continue_workflow task allows the process to proceed to the main workflow logic.

  5. The set_ignored_subs task creates a list of Microsoft 365 SKUs that should be ignored during the license removal process, including free trials, consumption-based apps, and products with extremely high license counts.

  6. If the Pax8 company ID is not configured for the organization, the pax8_not_configured_for_org task determines whether to create an alert ticket for unmapped organizations.

  7. The check_operation task evaluates input parameters to determine if this is a single subscription update operation or a bulk listing operation.

  8. For listing operations, the delay_based_on_org_name task introduces a delay based on the alphabetical order of the organization name to prevent API overload.

  9. The list_graph_subscriptions task retrieves all Microsoft 365 subscriptions from Microsoft Graph API and identifies undersubscribed SKUs where consumed units are less than enabled units.

  10. The check_undersubscribed_skus task determines if any undersubscribed SKUs were found and routes accordingly.

  11. If undersubscribed SKUs exist, the look_up_products task loads lookup tables to map Microsoft 365 SKU part numbers to Pax8 product names.

  12. The look_up_skus task processes the lookup information to prepare for Pax8 subscription matching.

  13. The pax_8_list_subscriptions task retrieves all active Pax8 subscriptions for the organization.

  14. The workflows_aw_get_pax_8_order task iterates through each Pax8 subscription to get detailed product information with a concurrency of 2.

  15. The find_eligible_subs task matches Microsoft 365 undersubscribed SKUs with eligible Pax8 subscriptions, excluding annual commitments and identifying over-purchased subscriptions.

  16. The make_ticket_if_needed task determines if any over-purchased subscriptions were found and creates a PSA ticket if necessary.

  17. If a ticket is created, the create_psa_service_ticket task generates a service ticket with details about the underprovisioned licenses.

  18. The apply_template task formats the ticket note content based on the PSA system type, using different templates for Halo PSA/Freshdesk versus other systems.

  19. The update_ticket task adds the formatted note to the created ticket with details about the license discrepancies.

  20. For single subscription updates, the get_subscription task retrieves the specific subscription details and calculates the quantity delta.

  21. If ConnectWise Manage is installed, the connect_wise_manage_get_service_ticket task retrieves the existing ticket information.

  22. The adjust_pax8_license_counts task performs the actual license quantity adjustment in Pax8, reducing the subscription by the calculated delta.

  23. If the adjustment succeeds, the workflow updates the ticket with a success message; if it fails, it updates the ticket with error details.

  24. The rewst_list_triggers task retrieves webhook trigger information if the organization variable for the trigger ID is not set.

  25. The rewst_bulk_upsert_organization_variables task creates or updates the webhook trigger ID organization variable for future use.

  26. The core_delay_workflow_for_period task introduces a one-minute delay and manages retry logic if the maximum retry count has not been reached.

  27. If no undersubscribed SKUs are found, the no_unaligned_subs_found task terminates the workflow without taking any action.

Crate prerequisites

Before unpacking this Crate:

The Pax 8 integration must first successfully be set up in Rewst .

The Microsoft Cloud Integration Bundle must be set up before unpacking this Crate, to enable the Microsoft Graph integration with Rewst.

Your PSA must be integrated with Rewst.

Unpack the Alert on Unused M365 Licenses Crate

  1. Navigate to Crates > Crate Marketplace in the left side menu of the Rewst Platform.

  2. Search for Alert on Unused M365 Licenses.

  3. Click Unpack Crate.

  4. Click Continue.

  5. Enter your Time Saved.

  6. Expand the Cron Job accordion menu and ensure that Enabled is toggled on.

  7. Click Unpack.

Use the Alert on Unused M365 Licenses Crate

The workflow must first be run as the top level parent organization. Then, the workflow can be used by child organizations.

The Crate runs on a cron trigger, and will execute the workflow to generate the ticket at the same time each day. You can adjust the chosen time for execution in the workflow itself.

  1. Navigate to Automations > Workflows in the left side menu of your Rewst platform.

  2. Search for Pax8 Extra License Removal.

  3. Click on the workflow to view it in the workflow builder.

  4. Click to open the edit trigger menu.

  5. Update the timing of the cron trigger as desired in the fields under Trigger Parameters. Note that when entering the time into the Cron Schedule field, the correct format is minutes followed by hour. For example. 18 3, not 3 18.

  6. Click Submit.

Got an idea for a new Crate? Rewst is constantly adding new Crates to our Crate Marketplace. Submit your idea or upvote existing ideas here in our Canny feedback collector.

Last updated

Was this helpful?