One of the recent changes to the Graph API that caught my attention was the introduction of “last changed” timestamp (lastUpdatedDateTime) for the licenseAssignmentState resource, announced on October 18th. After a few weeks wait, I’m finally able to see the new property for users in my tenant, so here are few notes about it.
First, how to see the property? Afaik, it’s currently only exposed via the Graph API and not visible anywhere in the UI or PowerShell endpoints. We can however get similar data by other means, but more on that later. So, to query the lastUpdatedDateTime value(s) for any licenses assigned to a given user, one needs to run a GET request against the https://firstname.lastname@example.org?$select=licenseAssignmentStates endpoint. Here’s how it looks like in the Graph explorer:
As you can see above, the list of licenses assigned to the user is now complemented with the lastUpdatedDateTime property. And since the property is newly introduced, it seems Microsoft it taking the “safe” approach of stamping its value with the date a license was last changed for the user. Any one license that is, so as this change is introduced to your tenant you will likely see all lastUpdatedDateTime fields reporting the same value, per given user. In the case of the user above, 21 Oct 2021 is what I see, which corresponds to the time the Project for Office 365 service was added to the Enterprise SKU.
This is the aforementioned “other means” by which we can get the data. As far as I can tell, the lastUpdatedDateTime field basically represents the “newest” (most recent) value of the AssignedTimestamp (assignedDateTime) property per given SKU. As each SKU contains multiple services (servicePlan), those can get updated at different times. What the lastUpdatedDateTime represents is the last time this happened, across all services corresponding to a given SKU.
Of course, going forward you can expect that the values returned will be more accurate. As new licenses are added or removed, and services toggled on/off, the lastUpdatedDateTime value will update accordingly. For example, disabling a service for the user we examined above will result in the following (note that the output seems to be sorted by the value of lastUpdatedDateTime, in descending order, similar to the output of the PowerShell cmdlet):
While this particular SKU was not visible on the first screenshot, it still had the same timestamp, 21 Oct 2021. After making a change, it has now surfaced to the top, with value representing today’s date. The other records corresponding to all the different SKUs assigned to the user remain unchanged. And here’s how the same change is represented on PowerShell’s side of things:
The rest of the values remain unchanged, thus we can now see that the value of the lastUpdatedDateTime property corresponds to the most recently changed value amongst the AssignedTimestamp values of the AssignedPlans collection.
Lastly, it looks like the value of lastUpdatedDateTime is not automatically updated when performing a license change, but likely a background process takes care of things. That, or some issue with the current implementation, results in the value showing as null, as shown below:
Hopefully this gets sorted out as the changes are rolled out in production. For finish, one more thing that needs to be mentioned. Currently, only the /beta endpoint seems to return this data, at least for my tenant. Since the Graph API changelog lists this change as available in the /v1.0 endpoint too, I suppose it’s just a matter of time for it to appear therein. But until then, keep that in mind and check the /beta endpoint if you get no data otherwise.