Skip to main content

Working on creating a User Provisioning automation to create AzureAD accounts. I need to verify license availability for the appropriate M365 License. I have the AzureAD orchestration in place, and the SaaS Management discovery piece working. I would like to verify if there are available M365 licenses (E3, F1, etc.), and if not pause and create a task or ticket to procure more licensing - which will be a process outside of Freshservice. I’m not seeing a way to either (1) read the SaaS discovery data, or query Azure AD for licenses. I can see where I can assign licenses (however, I’m using Group Based Licenses) using the AzureAD Orchestration.

Thoughts and ideas on how to accomplish this?

I got something working. I’m utilizing Workato to query my license Inventory via MSGraph, and then update the custom object table via the Freshservice API. I then have my automation verify that the available QTY is >= 1, and then create the user account.

It would be super useful in the asset module to be able to actually associate the M365 license to an actual M365 License (ex. E3, E5, etc.), not just the SaaS Module in general.


I am trying to do something similar with Graph API within the workflow itself.

I want to use the GET /subscribedSkus API to retrieve the license info. Then compare prepaid.enabled count to consumed count to see if a task needs to be created to reserve more licenses. I validated with Graph explorer that the info I need is there but can’t connect to the API from Freshservice.

I created an app registration with the necessary API permissions.  When I try to create an Oauth2 credential for Graph API.  It complains about a reply address after being prompted for consent.

@MattWalkerTx320 did you go down this road at all?  Am I wasting my time?


I believe I have this working.  I recalled when setting up the Zoom Oauth2 orchestration app there was a callback URL required to be entered on the Zoom side.  I used that callback URL as the Reply URL in the app registration.  That allowed me to successfully create an Oauth2 credential that can be used in a Web Request to make calls to MS Graph API endpoints.

Now when the SR is approved, I call out to Graph /subscribedSkus API

https://graph.microsoft.com/v1.0/subscribedSkus/<tenantID>_<skuID>?$select=prepaidUnits,consumedUnits

This returns JSON like below

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscribedSkus(prepaidUnits,consumedUnits)/$entity",
  "consumedUnits": 2,
  "prepaidUnits": {
    "enabled": 2,
    "suspended": 0,
    "warning": 0,
    "lockedOut": 0
  }
}

Which can be parsed and then Expressions can be used to calculate how many licenses if any are available.

Reply URL:  https://<domain>.freshservice.com/api/_/credentials/oauth_callback


Reply