Symptoms

An Office 365 sales order fails with the error

Can't update a subscription with deleted status

The task Provisioning "Subscription" for APS application Office 365 fails with the output:

APS Application Error:
500 Internal Server Error
[ApplicationUnknownError] Can't update a subscription with deleted status.

In sitelog:

2018-04-27 13:31:47,027 [  74] INFO flow        : Try to enable the subscription with id 'e5076705-28c9-401c-95b9-8362f793bdf1' (csp subscription id 'a825fb3a-fc48-4753-85af-8de48f21bde9').
...
2018-04-27 13:31:51,558 [  74] INFO flow        : Currently the subscription with id 'e5076705-28c9-401c-95b9-8362f793bdf1' (csp subscription id 'a825fb3a-fc48-4753-85af-8de48f21bde9') has status 'Canceled'.
2018-04-27 13:31:51,558 [  74] DEBUG flow        : Subscription 'e5076705-28c9-401c-95b9-8362f793bdf1' of customer '07d78008-328a-4482-b39a-584b25a848ed' does not exist and will be removed now.
2018-04-27 13:31:51,762 [  74] DEBUG flow        : Need to update the partner Id of the subscription e5076705-28c9-401c-95b9-8362f793bdf1 for offer 031c9e47-4802-4248-838e-778fb1d2cc05 = 1230001 -> 4560001
2018-04-27 13:31:51,762 [  74] INFO flow        : Try to set partner id 4560001 for the subscription with id 'e5076705-28c9-401c-95b9-8362f793bdf1' (csp subscription id 'a825fb3a-fc48-4753-85af-8de48f21bde9').
...
2018-04-27 13:31:53,058 [  74] ERROR aps_endpoint: SubscriptionsController.Post finished by exception Microsoft.Store.PartnerCenter.Exceptions.PartnerException: Can't update a subscription with deleted status
2018-04-27 13:31:53,058 [  74] ERROR aps_endpoint: Microsoft.Store.PartnerCenter.Exceptions.PartnerException: Can't update a subscription with deleted status

On the next run, the task Provisioning "Subscription" for APS application Office 365 completes. In sitelog the following events are registered:

2018-04-29 10:56:26,892 [  26] INFO aps_endpoint: adjust_subscriptions_impl(customer_id: 07d78008-328a-4482-b39a-584b25a848ed, offered: [offerId: 031c9e47-4802-4248-838e-778fb1d2cc05, trialOfferId: , limit: 1, apsTenantId: d8eb23d2-41ef-4d10-93d7-3db765d7a681, isAddon: False, isTrial: False, partnerId: 4560001, apsLicenseId: aa7c1c7c-5f04-4233-9464-da28d55d25a5, user_specific: True, possible_parents: , GetActiveOfferId: 031c9e47-4802-4248-838e-778fb1d2cc05, Annual: False], apsTenantId: d8eb23d2-41ef-4d10-93d7-3db765d7a681, wait: False)
2018-04-29 10:56:26,892 [  26] DEBUG flow        : Need to create subscription for  offer 031c9e47-4802-4248-838e-778fb1d2cc05 = 1
2018-04-29 10:56:26,892 [  26] DEBUG flow        : Creating subscription: for offerId '031c9e47-4802-4248-838e-778fb1d2cc05'; quantity=1.
...
2018-04-29 10:56:37,486 [  26] INFO flow        : Created a new subscription '6fa1e6be-c62f-4f6e-b00b-5b45bfe12ca9' for the customer '07d78008-328a-4482-b39a-584b25a848ed'. Csp subscription id: 'a1e2fee5-9237-4391-9f91-2a809767d3f5'.

Cause

There was another subscription with the same offer on this account in the past. The subscription grace period already passed, so it was canceled on Microsoft side. Office 365 detects this and deletes the subscription from the endpoint database. However, in case MPN ID is changed, it tries to update it for the deleted subscription right after deletion.

Such behavior was recognized as a software issue APSA-19808: O365 subscription provisioning fails with the exception 'Can't update a subscription with deleted status' if MPN ID was changed.

Resolution

Please upgrade the Office 365 APS application to the version 18.1 or later.

In order to workaround the issue, resubmit the task Provisioning "Subscription" for APS application Office 365.

See also: KB131529 Office365 provisioning fails "Can't update a subscription with deleted status"

Internal content