# Azure AI Search

This is not a LLM provider, but a content search provider. However since it is configured similarly to the other Azure services, it is included here. It allows you to do [vector search](/genaiscript/reference/scripts/vector-search) of your documents using [Azure AI Search](https://learn.microsoft.com/en-us/azure/search/search-what-is-azure-search).

```js
const index = await retrieval.index("animals", {
  type: "azure_ai_search",
});
await index.insertOrUpdate(env.files);
const docs = await index.search("cat dog");
```

### Managed Identity (Entra ID)

[Section titled “Managed Identity (Entra ID)”](#managed-identity-entra-id)

The service is configured through the `AZURE_AI_SEARCH_ENDPOINT` environment variable and the [configuration of the managed identity](https://learn.microsoft.com/en-us/azure/search/search-security-rbac?tabs=roles-portal-admin%2Croles-portal%2Croles-portal-query%2Ctest-portal%2Ccustom-role-portal).

```txt
AZURE_AI_SEARCH_ENDPOINT=https://{{service-name}}.search.windows.net/
```

1. Open your **Azure AI Search** resource in the [Azure Portal](https://portal.azure.com), click on **Overview** and click on **Properties**.

2. Click on **API Access control** and enable **Role-based access control** or **Both**.

3. Open the **Access Control (IAM)** tab and make sure your user or service principal has the **Search Service Contributor** role.

### API Key

[Section titled “API Key”](#api-key)

The service is configured through the `AZURE_AI_SEARCH_ENDPOINT` and `AZURE_AI_SEARCH_API_KEY` environment variables.

```txt
AZURE_AI_SEARCH_ENDPOINT=https://{{service-name}}.search.windows.net/
AZURE_AI_SEARCH_API_KEY=...
```