Forum Discussion
API for fetching Azure Product names and service plan identifiers for licensing?
Hello everyone,
I want to ask if there's an existing API to connect to, to be able to read / pull the information from the link below:
https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference
I currently have a project to pull related SKUs under a bundle for example Office 365 E5.
Thank you very much.
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)
9 Replies
- LeonPavesicSilver Contributor
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)- Kyros_JinCopper ContributorHi LeonPavesic,
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- LeonPavesicSilver Contributor
Hi Kyros_Jin,
you are welcome, I'm glad I could help you.
Kindest regards
Leon Pavesic