Create a product upgrade entity for a customer
You can create a product upgrade entity to upgrade a customer to a given product family (for example, Azure plan) using the ProductUpgradeRequest resource.
Prerequisites
Credentials as described in Partner Center authentication. This scenario supports authentication with App+User credentials. Follow the secure app model when using App+User authentication with Partner Center APIs.
A customer ID (
customer-tenant-id
). If you don't know the customer's ID, you can look it up in Partner Center by selecting the Customers workspace, then the customer from the customer list, then Account. On the customer's Account page, look for the Microsoft ID in the Customer Account Info section. The Microsoft ID is the same as the customer ID (customer-tenant-id
).The product family to which you want to upgrade the customer.
C#
To upgrade a customer to Azure plan:
Create a ProductUpgradesRequest object and specify the customer identifier and "Azure" as the product family.
Use the IAggregatePartner.ProductUpgrades collection.
Call the Create method and pass in the ProductUpgradesRequest object, which will return a location header string.
Extract the upgrade-id from the location header string that can be used to query the upgrade status.
// IAggregatePartner partnerOperations;
string selectedCustomerId = "58e2af4f-0ad3-4688-8744-be2357cd939a";
string selectedProductFamily = "Azure";
var productUpgradeRequest = new ProductUpgradesRequest
{
CustomerId = selectedCustomerId,
ProductFamily = selectedProductFamily
};
var productUpgradeLocationHeader = partnerOperations.ProductUpgrades.Create(productUpgradeRequest);
var upgradeId = Regex.Split(productUpgradeLocationHeader, "/")[1];
REST request
Request syntax
Method | Request URI |
---|---|
POST | {baseURL}/v1/productupgrades HTTP/1.1 |
Request headers
For more information, see Partner Center REST headers.
Request body
The request body must contain a ProductUpgradeRequest resource.
Request example
POST https://api.partnercenter.microsoft.com/v1/productupgrades HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: c245d5f2-1de3-4ae0-9e42-95e38e3cb8ff
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
X-Locale: en-US
MS-PartnerCenter-Application: Partner Center .NET SDK Samples
Content-Type: application/json
Host: api.partnercenter.microsoft.com
Content-Length: 340
Expect: 100-continue
Connection: Keep-Alive
{
"customerId": "4c721420-72ad-4708-a0a7-371a2f7b0969",
"productFamily": "Azure"
}
Important
As of June 2023, the latest Partner Center .NET SDK release 3.4.0 is now archived. You can download the SDK release from GitHub, along with a readme file that contains useful information.
Partners are encouraged to continue to use the Partner Center REST APIs.
REST response
If successful, the response contains a Location header that has a URI that can be used to retrieve product upgrade status. Save this URI for use with other related REST APIs.
Response success and error codes
Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters. For the full list, see Partner Center REST error codes.
Response example
HTTP/1.1 202 Accepted
Content-Length: 0
Location: productUpgrades/42d075a4-bfe7-43e7-af6d-7c68a57edcb4
MS-CorrelationId: bbbb1111-cc22-3333-44dd-555555eeeeee
MS-RequestId: cb82f7d6-f0d9-44d4-82f9-f6eee6e68390
MS-CV: iqOqN0FnaE2y0HcD.0
MS-ServerId: 030020525
Date: Thu, 28 Sep 2019 20:35:35 GMT