Force cancelation of subscription in Azure with REST call

Normally you can only cancel/disable a subscription by code if the subscription is empty.

If you add IgnoreResourceCheck=true and thereby still cancel the subscription. This give you the grace time before deletion. Remember to change {subscriptionId} in the URI{subscriptionId}/providers/Microsoft.Subscription/cancel?IgnoreResourceCheck=true&api-version=2021-10-01

Documentation on grace period