# Auto Discover Azure SQL Databases

Apono’s Auto Discovery feature identifies tagged Azure SQL database instances, including MySQL and PostgreSQL. Rather than integrating each instance individually, you can integrate selected databases and their resources at once during your Azure Subscription or Azure Management Group setup.

{% hint style="warning" %}
This capability requires network access to each discoverable database. If your databases are in different Azure networks, make sure to create an Azure connector for each network.

Since Auto Discovery uses Azure Resource Graph, direct database access is not required for the initial discovery.
{% endhint %}

***

### Prerequisites

<table><thead><tr><th width="258">Item</th><th>Description</th></tr></thead><tbody><tr><td><strong>Apono Connector</strong></td><td><p>One or more <a href="../../apono-connector-for-azure">Apono connectors for Azure</a> with network access to your Azure SQL databases</p><p><strong>Minimum Required Version</strong>: 1.3.6</p><p>Follow these steps to <a href="../../apono-connector-for-azure/updating-a-connector-in-azure">update an existing connector</a>.</p></td></tr><tr><td><strong>Azure Permissions</strong></td><td><p>Permissions to complete the following tasks in your Azure instance:</p><ul><li>Create and manage Azure Key Vault secrets</li><li>Tag Azure resources</li><li>Access to your Azure Subscription or Azure Management Group instance</li></ul></td></tr></tbody></table>

***

### Enable Auto Discovery

<figure><img src="https://1094436629-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv6MBfUGvblSdAz31yJXm%2Fuploads%2Fgit-blob-27cb7f75e0b0da34b909b9c276b541d250593eb8%2Fazure-auto-discovery.png?alt=media" alt="" width="375"><figcaption><p><em>Azure SQL instances under Connect Sub Integration</em></p></figcaption></figure>

Follow these steps to enable Auto Discovery:

1. In your Azure SQL database, create a user for the Apono connector. As part of this step, you will also create a secret.
   * [Azure MySQL](https://docs.apono.io/docs/azure-environment/azure-mysql#create-a-mysql-user)
   * [Azure PostgreSQL](https://docs.apono.io/docs/azure-environment/azure-postgresql#create-a-postgresql-user)
2. [Tag your database instance](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources-portal#add-tags) based on the authentication method you selected in the previous step. In the table below, the values shown in *italics* are the exact text you should enter when adding these tags.

<table><thead><tr><th width="262">Key</th><th>Value or Description</th></tr></thead><tbody><tr><td><em>vault-url</em></td><td><p>URL of the Azure Key Vault containing the secret</p><p><br><strong>Example</strong>: https://mystore.vault.azure.net/</p></td></tr><tr><td><em>secret-name</em></td><td><p>Name of the secret in Azure Key Vault</p><p><br><strong>Example</strong>: db-credentials</p></td></tr></tbody></table>

3. In the Apono UI, on the [**Catalog**](https://app.apono.io/catalog?search=azure) tab, click **Azure**. The **Connect Integrations Group** page appears.
4. Under **Discovery**, click **Azure Management Group** or **Azure Subscription**.
5. Under **Connect Sub Integration**, select **Database**, **Table**, and **Role** to control the granularity of discovery in each discovered instance.
6. Complete the Azure Management or Azure Subscription [integration](https://docs.apono.io/docs/azure-environment/azure-integrations/integrate-with-azure-management-groups-or-subscriptions/..#integrate-azure) (steps **3-10**).

After connecting your Azure Management or Azure Subscription to Apono, you will be redirected to the **Connected** tab to view your integrations. The new Azure integration, along with sub-integrations for each database instance, initialize during the first data fetch. The integration becomes **Active** once the process completes.

Now that you have completed this integration, you can [create access flows](https://docs.apono.io/docs/access-flows/access-flows) that grant permission to your Azure SQL database resources.

***

### Troubleshooting

If SQL database instances appear with errors on your **Integrations** page, follow these steps:

1. **Check Tags**: Verify all required tags are present and correctly formatted.
2. **Connector Permissions**: Ensure the Apono connector has necessary permissions to read tags and access secrets.
3. **Network connectivity**: Ensure each SQL database instance is accessible by an Apono connector within the same network.

{% hint style="success" %}
For any questions about the discovery process, please contact Apono Support.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.apono.io/docs/azure-environment/azure-integrations/integrate-with-azure-management-groups-or-subscriptions/auto-discover-azure-sql-databases.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
