locked
Get list of users for a customer subscription (REST API) RRS feed

Answers

All replies

  • Hi!

    Make a request to the Users with the Graph API:

    https://graph.windows.net/myorganization/users?api-version[&$filter]

    The User Object has AssignedLicense,AssignedPlan and match the SkuId and ServicePlanId


    • Edited by Pseudocode Wednesday, May 18, 2016 2:14 PM
    Wednesday, May 18, 2016 2:11 PM
  • I'm already retrieving the list of users with their assigned licenses, but I don't see a way to match a license (skuId) to an Office 365 subscription. How do I match licenses to subscriptions in order to view the users of a particular subscription?
    • Edited by theodorejb Wednesday, May 18, 2016 3:50 PM Improve wording
    Wednesday, May 18, 2016 2:58 PM
  • Hi,

    We can firstly get all subscriptions for each user and then compare the subscription offer uri with Offer id in Price list.


    Price list download link:

    https://partnercenter.microsoft.com/pc/api/cms/download?id=Sales/dcf234ca-5509-49a8-8d81-098569df4b64/May-2016-Cloud-Reseller_Pricelist_InvariantCulture_Default.zip

    Thanks

    Best Regards


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Thursday, May 19, 2016 9:11 AM
  • What API endpoint do I use to get all subscriptions for each user?
    • Edited by theodorejb Thursday, May 19, 2016 1:19 PM
    Thursday, May 19, 2016 1:14 PM
  • Did you try to call:

    /myorganization/subscribedSkus?

    to get all subscribedSkus for a tenant
    and then, match the ServicePlanId with the User from

    https://graph.windows.net/myorganization/users

    Thursday, May 19, 2016 2:55 PM
  • Yes, that lets me match users to SKUs but what I'm trying to do is match users to Office 365 subscriptions. How do I determine which subscription a SKU is for?
    • Edited by theodorejb Thursday, May 19, 2016 3:07 PM
    Thursday, May 19, 2016 2:59 PM
  • Hi,

    i assign subscriptions (license) to specific users with the CREST and GRAPH API.
    I can check my code tomorrow and post some examples.
    Hope that helps!

    Thursday, May 19, 2016 5:19 PM
  • Thanks! I'm looking forward to see your examples.
    Thursday, May 19, 2016 8:51 PM
  • So here are my steps to assign a subscription to a user.

    1. Book a subscription
    2. Get the Entitlements Information for the subscription with
      https://api.cp.microsoft.com/{0}/entitlements/{subscriptionId}
      In the Entilement there is a product_uri 
      /3c95518e-8c12-41e3-9627-0ca338800f22/Products/cdd28e44-54e3-425e-be4c-737fab277d3
      The Last GUID is the product GUID for my subscription (SkuId)
    3. Next step is to call the subscribedSkus for the tenant to get the right servicePlanId
      https://graph.windows.net/myorganization/subscribedSkus?api-version=1.6
    4. The last step is to assignLicense with the servicePlanId
      https://graph.windows.net/myorganization/users/{0}/assignLicense?api-version=1.6

    You are right, there is no match between skuid and Subscription Id (the way back from user to subscription)


    • Edited by Pseudocode Friday, May 20, 2016 8:29 AM
    Friday, May 20, 2016 8:29 AM
  • I figured this out based on a reply to the Azure Graph API. Assigned licenses. How to find related subscription post.

    When a subscription is requested it includes a links/offer/uri property which can be used to request the subscription offer. The resulting offer object includes a product/id property which (when lowercased) matches to a user skuId.

    • Marked as answer by theodorejb Friday, May 20, 2016 2:50 PM
    Friday, May 20, 2016 2:50 PM
  • Thanks for the Information.

    If you mean this line:
    /3c95518e-8c12-41e3-9627-0ca338800f22/Products/cdd28e44-54e3-425e-be4c-737fab277d3

    This is working only, if you have one eg. Office 365 Business subscription for the tenant.If you have two Office 365 Business subscriptions, you can not match this back from user to the subscription.

    Friday, May 20, 2016 2:57 PM