How to tell who bought subscription

Viewed 254

As a CSP partner, we currently use the MSOL cmdlets for our automation process. We are currently switching our implementation to Microsoft Graph API.

MSOL offers, through Get-MsolSubscription, a way to know if a subscription has been bought by us or by another service provider. To know that, we inspect the OwnerObjectId attribute and if the value is set with our Id, we know it has been bought to us. Otherwise this attribute is empty.

It seems that Microsoft Graph API does not support this feature. SubscribedSku does not seem to expose the feature we are looking for.

Any ideas?

1 Answers

If I understand properly, you want to get a list of subscriptions by order for Azure CSP integration.

You can retrieve a collection of Azure Cloud Solution Provider (Azure CSP) subscription resources that correspond to an order. To retrieve a resource, you can use PowerShell, C#, or REST API commands.

Powershell guide

$customer = Get-PCCustomer -tenantid '<tenant id GUID>'
Get-PCSubscription -tenantid $customer.id -orderid '<order id GUID>'

C# SDK guide

To get a list of subscriptions by order, use your IAggregatePartner.Customers collection and call the ById() method. Then call the Subscriptions property, followed by the ByOrderId() method. Finish by calling Get() or GetAsync().

// IAggregatePartner partnerOperations;
// var selectedCustomerId as string;
// string orderID;

ResourceCollection<Subscription> customerSubscriptions = partnerOperations.Customers.ById(selectedCustomerId).Subscriptions.ByOrder(orderID).Get();

REST API Example

GET https://api.partnercenter.microsoft.com/v1/customers/{customer-tenant-id}/subscriptions?order_id={id-for-order} HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: 16fee928-dc2c-412f-adbb-871f68babf16
MS-CorrelationId: c49004b1-224f-4d86-a607-6c8bcc52cfdd
Connection: Keep-Alive

See more details in this document.

Related