> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-xdr/configure-cortex-xdr/cortex-xdr-data-sources/cloud-service-provider-csp-onboarding/ibm-cloud-cloud-onboarding/offboard-ibm-cloud.md).

# Offboard IBM Cloud

Offboard an IBM Cloud account from Cortex XDR by deleting the cloud instance and removing the Cortex XDR resources from your IBM Cloud account.

Follow this procedure to stop monitoring an IBM Cloud account and remove all Cortex XDR resources from it. You delete the cloud instance in Cortex XDR first, and then remove the service ID, its API keys, custom roles, and access policies from your IBM Cloud account.

Delete the cloud instance before you remove the resources in IBM Cloud. If you remove the resources first, Cortex XDR can no longer authenticate and reports permission errors on the cloud instance until you delete it.

## Before you begin

Ensure that you have the following:

* A Cortex XDR role with Data Sources - View & Edit permissions.
* The directory where you ran the Terraform template, including the Terraform state file (`terraform.tfstate`). If you no longer have the state file, see [Remove the resources in the IBM Cloud console](#remove-the-resources-in-the-ibm-cloud-console).
* An IBM Cloud administrator API key with permission to delete service IDs, custom roles, and access policies in the account.
* Terraform installed on your machine.

## Delete the cloud instance in Cortex XDR

Delete the cloud instance to stop all scanning of the IBM Cloud account.

1. In Cortex XDR, select **Settings → Data Sources & Integrations**, and then open the **IBM Cloud** cloud instances.
2. Right-click the cloud instance and select **Delete**.
3. Confirm the deletion.

Cortex XDR stops scanning the account. Assets from the account are no longer updated.

## Remove the resources with Terraform

Use Terraform to remove all the resources that the authentication template created.

1. Navigate to the directory where you ran the Terraform template:

   ```bash
   cd ~/terraform/ibm-cloud-connector-1
   ```
2. Set your IBM Cloud administrator API key as an environment variable:

   ```bash
   export IC_API_KEY="<your IBM Cloud administrator API key>"
   ```
3. Run the destroy command with the parameter file:

   ```bash
   terraform destroy --var-file=template_params.tfvars
   ```
4. Review the destruction plan, and then enter `yes` to confirm.

Terraform removes the service ID, its API keys, the custom roles, the access policies, and the tags. Deleting the service ID API keys revokes the credential that Cortex XDR stored, so it can no longer be used to access your account.

After Terraform completes, delete the Terraform directory and the state file securely. The state file contains the API key values.

## Remove the resources in the IBM Cloud console

If you no longer have the Terraform state file, remove the resources manually in the IBM Cloud console. In the resource names, `<suffix>` is the unique suffix of the cloud instance.

1. In the IBM Cloud console, select **Manage → Access (IAM) → Service IDs**.
2. Find the service ID `cortex-<suffix>-service-id`. You can search for the `managed_by:paloaltonetworks` tag.
3. Delete the service ID. Deleting the service ID also deletes its API keys and the access policies assigned to it.
4. Select **Manage → Access (IAM) → Roles**, and delete the following custom roles:

   * `CortexKmsRole<SUFFIX>`
   * `CortexSmRole<SUFFIX>`
   * `CortexIamRole<SUFFIX>`
   * `CortexCosRole<SUFFIX>`

   In the custom role names, `<SUFFIX>` is the suffix in uppercase, without hyphens or other non-alphanumeric characters.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-xdr/configure-cortex-xdr/cortex-xdr-data-sources/cloud-service-provider-csp-onboarding/ibm-cloud-cloud-onboarding/offboard-ibm-cloud.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
