> For the complete documentation index, see [llms.txt](https://docs.stoik.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stoik.io/prevention-tools/cloud-scan/azure/bad-tenant.md).

# "Bad Tenant" error

The `BAD TENANT` error appears when the Azure setup of the Cloud scan runs on a different tenant than the one you authorized.

## Cause

When running the automatic script for the Azure Cloud scan, the following error may appear:

`BAD TENANT - Stoïk Cloud Scanner application not found, please see this link for more information`

This error occurs when the **Stoïk application has not been registered correctly on your Azure environment**. The main reason is that a different environment was selected during the first stage of setup and when the script was run.

## Example

The example below illustrates a problematic setup:

{% stepper %}
{% step %}

### Select the provider

The user selects the provider `Microsoft Azure`.

<figure><img src="https://content.gitbook.com/content/aDGGQ49Oui29Ft0kJjSm/blobs/NWPK4gXD1wKs8U1vuOPE/image%20png%20Oct%2003%202024%2009%2016%2002%204325%20AM.png" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Choose the account

The user selects their `xavier@bar.test` account associated with the tenant `bar.test`.

<figure><img src="https://content.gitbook.com/content/aDGGQ49Oui29Ft0kJjSm/blobs/IJMiaLxdwfQvqyMiueVz/image%20png%20Oct%2003%202024%2009%2014%2025%204762%20AM.png" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Request the application registration

The Stoïk Cloud Scanner application asks to register on the tenant `bar.test`.

<figure><img src="https://content.gitbook.com/content/aDGGQ49Oui29Ft0kJjSm/blobs/V2k0lLoguK5BYclSqEXW/image%20png%20Oct%2003%202024%2009%2021%2042%203314%20AM.png" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Run the script on a different tenant

The user tries to run the script on the tenant `foo.test` (shown at the top right of the image). Because the Stoïk Cloud Scanner application was authorized on a different tenant (`bar.test`), the script cannot assign the necessary roles on `foo.test`.

<figure><img src="https://content.gitbook.com/content/aDGGQ49Oui29Ft0kJjSm/blobs/9xq9gyyZ3EhqYwuXS0B8/image%20png%20Oct%2003%202024%2009%2034%2044%202548%20AM.png" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## Solution

* Run the script on the same Azure tenant that was used when authorizing the Stoïk application (the tenant selected in step 2 above).
* If you are unsure which tenant was used:
  * Disconnect from all your accounts on <https://portal.azure.com>.
  * Then restart the installation of the tool on Stoïk Protect.

{% hint style="info" %}
If the issue persists, contact Stoïk at <protect@stoik.io> for further assistance.
{% endhint %}


---

# 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://docs.stoik.io/prevention-tools/cloud-scan/azure/bad-tenant.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.
