Authenticating Powershell commandlets using Graph api access token

chonky_kittu 41 Reputation points
2022-07-19T14:15:57.687+00:00

Hi,

I want to read subscription expiry date for a user using graph API.

The graph api does not expose end dates (as of today), in the documentation : https://learn.microsoft.com/en-us/graph/api/subscribedsku-list?view=graph-rest-1.0&tabs=http

This answer: https://learn.microsoft.com/en-us/answers/questions/518073/is-there-a-way-to-get-license-expiry-and-license-a.html confirms that. The answer also mentions that I can get the subscription end date using Get-MsolSubscription. This commandlet needs the user to input credentials.

Is there any way I can use the graph api access token to access/execute Get-MsolSubscription?

TIA.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,564 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 95,096 Reputation points MVP
    2022-07-19T19:33:18.853+00:00

    You can, but you need to pass two sets of tokens, one for the old AAD Graph and one for the Microsoft Graph. I.e.:

    Connect-MsolService -AdGraphAccessToken token1 -MsGraphAccessToken token2  
    

0 additional answers

Sort by: Most helpful