Κοινή χρήση μέσω


Cancel an Azure subscription

Applies to: Partner Center | Partner Center operated by 21Vianet | Partner Center for Microsoft Cloud for US Government

If compromise or abuse, partners with Azure customer subscriptions can cancel the subscriptions directly from Partner Center portal or by API, shutting down suspicious activity discovered in their Azure plan subscriptions.

This API will cancel an Azure subscription. If partners want to cancel more than one subscription, they need to separately call the API to cancel each one.

If partners want to suspend their Azure plan, they should use the existing API available, Update a subscription by ID.

Cancelling Azure plan isn't supported by the following API.

Partners must be Global Administrators with Admin Agent roles to cancel.

Prerequisites

  • Credentials as described in Partner Center authentication This scenario supports authentication with both standalone App and App+User credentials.

  • Customer_id.

  • Subscription_id.

  • Entitlement_id.

C#

To cancel an Azure subscription, you need to identify your customer ID, subscription ID, and entitlement ID for that subscription.

REST request

Request syntax

Method Request URI
POST {baseURL}/v1/customers/{customer_id}/subscriptions/{subscription_id}/azureEntitlements/{entitlement_id}/cancel HTTP/1.1

URI parameter

This table lists the required query parameters to cancel an Azure subscription.

Name Type Required Description
customer_id String Y The value is a string that denotes the identifier of the customer.
subscription_id String Y The value is a string that denotes the identifier of the subscription.
entitlement_id String Y The value is a string that denotes the identifier of the Azure subscription entitlement.

Request headers

See Partner Center REST headers.

Request body

HTTP
{ "cancellationReason": "compromise" }

Request example

POST
[https://api.partnercenter.microsoft.com/v1/customers/{customer_id}/subscriptions/{subscription_id}/azureEntitlements/{entitlement_id}/cancel](https://api.partnercenter.microsoft.com/v1/customers/%7bcustomer_id%7d/subscriptions/%7bsubscription_id%7d/azureEntitlements/%7bentitlement_id%7d/cancel)
HTTP/1.1
Accept: application/json
MS-RequestId: 655890ba-4d2b-4d09-a95f-4ea1348686a5
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
{
 "id": "bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
 "friendlyName": "Cancel_Azure_Subscription ",
 "status": "active",
 "subscriptionId": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
 "links": {
  "self": {
  "uri":
  "/customers/aaaabbbb-0000-cccc-1111-dddd2222eeee/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/azureEntitlements/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
  "method": "GET",
"headers": []
   }
  }
}

REST response

If successful, this method returns an Azure entitlement for a subscription resource in the response body.

Response success and error codes

Each response comes with an HTTP status code that indicates success or failure and more debugging information. Use a network trace tool to read this code, error type, and other parameters. For the full list, see Partner Center REST error codes.

HTTP Status HTTP Code Error code Description
BadRequest 400 900118 Invalid customer ID.
BadRequest 400 800002 Customer ID {0} should have GUID format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
BadRequest 400 800002 Subscription ID is required.
BadRequest 400 800002 Entitlement ID is required.
BadRequest 400 800002 The Azure entitlement cancellation request content is required.
Forbidden 403 900159 The partner with account ID {0} and organization ID {1} has no commerce relationship with the customer with account ID {2} and organization ID {3}.
BadRequest 400 900307 Cancellation reason '{0} is invalid.
NotFound 404 800111 Azure entitlement with ID {0} isn't found.

Response example

The response for canceling a subscription includes the entitlement status. Expect about 10 mins for the status to be reflected (that is, active to inactive).

HTTP
HTTP/1.1 200 OK
Content-Length: 1132
Content-Type: application/json; charset=utf-8
MS-CorrelationId: bbbb1111-cc22-3333-44dd-555555eeeeee
MS-RequestId: 22bfd0fb-d1e6-4a8f-aa1a-124b7c820d80
MS-CV: cmde2DtbuUWi8JLq.0
MS-ServerId: 201022015
Date: Wed, 14 Dec 2022 00:12:53 GMT
{
"id": "bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
"friendlyName": " Cancel_Azure_Subscription",
"status": "active",
"subscriptionId": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"links": {
"self": {
"uri":
"/customers/aaaabbbb-0000-cccc-1111-dddd2222eeee/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/azureEntitlements/bbbb1b1b-cc2c-dd3d-ee4e-ffffff5f5f5f",
"method": "GET",
"headers": []
 }
}