github.com/kyma-project/kyma-environment-broker@v0.0.1/docs/user/05-20-deprovisioning-kyma-environment.md (about) 1 # Deprovision SAP BTP, Kyma runtime using Kyma Environment Broker 2 3 This tutorial shows how to deprovision SAP BTP, Kyma runtime on Azure using Kyma Environment Broker (KEB). 4 5 ## Steps 6 7 1. Ensure that these environment variables are exported: 8 9 ```bash 10 export BROKER_URL={KYMA_ENVIRONMENT_BROKER_URL} 11 export INSTANCE_ID={INSTANCE_ID_FROM_PROVISIONING_CALL} 12 ``` 13 14 2. Get the [access token](../contributor/01-10-authorization.md#get-the-access-token). Export this variable based on the token you got from the OAuth client: 15 16 ```bash 17 export AUTHORIZATION_HEADER="Authorization: Bearer $ACCESS_TOKEN" 18 ``` 19 20 3. Make a call to KEB to delete a Kyma runtime on Azure. 21 22 ```bash 23 curl --request DELETE "https://$BROKER_URL/oauth/v2/service_instances/$INSTANCE_ID?accepts_incomplete=true&service_id=47c9dcbf-ff30-448e-ab36-d3bad66ba281&plan_id=4deee563-e5ec-4731-b9b1-53b42d855f0c" \ 24 --header 'X-Broker-API-Version: 2.13' \ 25 --header "$AUTHORIZATION_HEADER" 26 ``` 27 28 A successful call returns the operation ID: 29 30 ```json 31 { 32 "operation":"8a7bfd9b-f2f5-43d1-bb67-177d2434053c" 33 } 34 ``` 35 36 4. Check the operation status as described in the [Check operation status](05-30-operation-status.md) document. 37 38 ## Subaccount Cleanup Job 39 40 The standard workflow for [SAP BTP Service Operator](https://github.com/SAP/sap-btp-service-operator) resources is to keep them untouched by KEB because users may intend to 41 keep the external services provisioned through the SAP BTP Service Operator still operational. In this case, when calling deprovisioning in the SAP BTP cockpit, users are informed 42 there are still instances provisioned by SAP BTP Service Operator, and the user is expected to handle the cleanup. 43 44 There is one exception, and that is the [Subaccount Cleanup CronJob](../contributor/06-30-subaccount-cleanup-cronjob.md). KEB [parses the `User-Agent` HTTP header](../../internal/process/deprovisioning/btp_operator_cleanup.go#L87) for 45 `DELETE` call on `/service_instances/${instance_id}` endpoint and forwards it through the operation to the processing step `btp_operator_cleanup` handling 46 soft delete for existing SAP BTP Service Operator resources. Because the `subaccount-cleanup` Job is triggered automatically and deletes only Kyma runtimes where the whole subaccount is 47 intended for deletion, it is necessary to execute the SAP BTP Service Operator cleanup procedure as well.