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.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,399 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,310 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Vasil Michev 100K Reputation points MVP
    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 Vendor
    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".

    0 comments No comments