How to fetch the expiration date of an license that's assigned to a user using Graph APIs? Is there any direct or indirect way available to get the data?

Seepana Rajaraju 0 Reputation points
2023-11-22T14:47:56.1233333+00:00

I need to know the API or a way to fetch the expiration date of an Azure license that's assigned to a user in a tenant.

Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Vasil Michev 119.7K Reputation points MVP Volunteer Moderator
    2023-11-22T17:08:37.52+00:00

    License expiration date is exposed via the /beta/directory/subscriptions endpoint (look for the nextLifecycleDateTime property). Currently not supported in /v1.0.

    0 comments No comments

  2. Sourabh Gupta 800 Reputation points Microsoft External Staff
    2023-11-26T11:04:39.7166667+00:00

    This Capability was introduced by Microsoft in Graph-Beta. Look for the nextLifecycleDateTime property

    Using Graph API:

    https://graph.microsoft.com/beta/directory/subscriptions?$select=id,nextLifecycleDateTime,createdDateTime,ocpSubscriptionId

    Using PowerShell:

    Get-MgBetaDirectorySubscription

    Permissions Needed:

    Delegated (work or school account) - Organization.Read.All, Directory.Read.All

    Delegated (personal Microsoft account) - Not supported.

    Application - Organization.Read.All, Directory.Read.All, Organization.ReadWrite.All

    There was a feature requested by someone, which can be accessed here

    Documentationhttps://learn.microsoft.com/en-us/graph/api/directory-list-subscriptions?view=graph-rest-beta&tabs=http

    Refer to the screenshot below for the sample response

    IMG20231125221438

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.