Forum Discussion
API for fetching Azure Product names and service plan identifiers for licensing?
- Oct 11, 2023
Hi Kyros_Jin,
No, there is no existing API to connect to and pull the information from the link you provided.
The link you provided is a reference table that lists all of the Azure product names and service plan identifiers for licensing.
The table is updated regularly, so it is not possible to create an API that would always return the most up-to-date information.Instead, you can use the Microsoft Graph API to fetch Azure product names and service plan identifiers for licensing. The Microsoft Graph API is a RESTful API that provides access to Microsoft data and services.
To use the Microsoft Graph API to fetch Azure product names and service plan identifiers for licensing, you would need to:
- Create an Azure AD application and grant it the necessary permissions.
- Get an access token for the application.
- Make a GET request to the following endpoint:
https://graph.microsoft.com/v1.0/subscribedSkus
The response will be a list of objects, each of which represents a subscribed SKU. Each object will have the following properties:
- skuPartNumber: The product name.
- skuId: The service plan identifier.
For example, the following response shows the product name and service plan identifier for Office 365 E5:
[ { "skuPartNumber": "ENTERPRISEPREMIUM", "skuId": "e4654015-5daf-4a48-9b37-4f309dddd88b" } ]You can then use this information to fetch related SKUs under a bundle. For example, to fetch the related SKUs for Office 365 E5, you could use the following code:
import requests # Get an access token for the Azure AD application. access_token = ... # Make a GET request to the subscribedSkus endpoint. response = requests.get( "https://graph.microsoft.com/v1.0/subscribedSkus", headers={"Authorization": f"Bearer {access_token}"} ) # Get the product name and service plan identifier for Office 365 E5. sku_part_number = "ENTERPRISEPREMIUM" sku_id = "e4654015-5daf-4a48-9b37-4f309dddd88b" # Fetch the related SKUs for Office 365 E5. related_skus_response = requests.get( "https://graph.microsoft.com/v1.0/subscribedSkus?$filter=skuId eq '%s'" % sku_id, headers={"Authorization": f"Bearer {access_token}"} ) # Get the list of related SKUs. related_skus = related_skus_response.json() # Print the list of related SKUs. for related_sku in related_skus: print(related_sku["skuPartNumber"])This code will print the following output:
ENTERPRISESUPPORT EXCHANGE_S_STANDARD ONEDRIVE_S_STANDARD SHAREPOINT_S_STANDARD TEAMS_S_STANDARD VISIO_S_STANDARD
Some useful links:
- Microsoft Graph API documentation: https://developer.microsoft.com/en-us/graph
- Product names and service plan identifiers for licensing: https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
Thank you very much for your response. Exactly what I needed. You don't know how much time you saved me and the contribution you made for me to enable something awesome for our development. Appreciate the help!
Cheers,
Kyros
Hi Kyros_Jin,
you are welcome, I'm glad I could help you.
Kindest regards
Leon Pavesic
- Bhoopesh_KumarNov 08, 2023Copper Contributor
Hi LeonPavesic ,
Can you please help me?
How to get SKU/Product Display Name by the API?
I am able to get data from below mentioned two APIs but not able to find display Name.
f'https://graph.microsoft.com/v1.0/users/{user_id}/licenseDetails'
'https://graph.microsoft.com/v1.0/servicePrincipals'Are these 2 APIs have any relation for the join data?
For Example:
"skuId":"c5928f49-12ba-48f7-ada3-0d743a3601d5",
"skuPartNumber":"VISIOCLIENT"Visio Online Plan 2 VISIOCLIENT c5928f49-12ba-48f7-ada3-0d743a3601d5 Display Name: "Visio Online Plan 2 ".
Required for me:Regards
Bhoopesh Kumar
- Kyros_JinNov 09, 2023Copper ContributorWhat we've done is we downloaded the CSV from the products website of Microsoft. We then uploaded it to our site, and join the data from graph API to this table filled with data from CSV for update the friendly name. Not the best solution but the best we can think of as of the moment.
- Bhoopesh_KumarNov 09, 2023Copper Contributor
Hi Kyros
Thanks for the Reply. Appreciate the help!!!
Regards
Bhoopesh Kumar
- LeonPavesicNov 09, 2023Silver Contributor
Hi Bhoopesh_Kumar,
thanks for your question.To get the SKU/Product Display Name via the Microsoft Graph API, you can use the `subscribedSkus` endpoint.
However, please note that the `subscribedSkus` endpoint does not return the display-friendly name of the SKU. The SKU part number returned by the `subscribedSkus` endpoint is not exactly presentable.
As for the relationship between the two APIs you mentioned (`/users/{user_id}/licenseDetails` and `/servicePrincipals`), they serve different purposes and do not directly relate to each other for joining data.
The `/users/{user_id}/licenseDetails` API is used to get license details for a user, while the `/servicePrincipals` API is used to get service principal objects.The `skuId` you mentioned (e.g., "c5928f49-12ba-48f7-ada3-0d743a3601d5") is a unique identifier for the SKU, and the `skuPartNumber` (e.g., "VISIOCLIENT") is a unique identifier for the part number of the SKU. These identifiers do not directly provide the display name of the product (e.g., "Visio Online Plan 2").
Unfortunately, there isn't an API for returning the descriptive service plan name.
https://graph.microsoft.com/v1.0/subscribedSkus.
Get Display Name for License SKU in Microsoft Graph. https://stackoverflow.com/questions/58720902/get-display-name-for-license-sku-in-microsoft-graph.
Getting the display name for a subscribedSku from Graph API. https://stackoverflow.com/questions/50959422/getting-the-display-name-for-a-subscribedsku-from-graph-api.
List subscribedSkus - Microsoft Graph v1.0 | Microsoft Learn. https://learn.microsoft.com/en-us/graph/api/subscribedsku-list?view=graph-rest-1.0.
Azure License Management with Microsoft Graph. https://azurecloudai.blog/2022/04/11/azure-license-management-with-microsoft-graph/
Microsoft Graph API - Contracts - How to pull subscribed skus?. https://stackoverflow.com/questions/51185507/microsoft-graph-api-contracts-how-to-pull-subscribed-skus.Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)- Bhoopesh_KumarNov 09, 2023Copper Contributor