> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getmuster.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure AI Foundry / Azure OpenAI

> Automatic monitoring of Azure OpenAI deployments and AI Foundry projects.

## How it works

The Azure AI connector:

* **Discovers** Azure OpenAI deployments and AI Foundry projects via the Azure Resource Manager API
* **Streams** invocations from Azure Application Insights dependency logs

Elitery deploys and manages the connector. Your developers do nothing.

***

## What Elitery needs from you

**Azure service principal** with read-only access:

```bash theme={null}
# Create service principal
az ad sp create-for-rbac --name "muster-connector" --role Reader \
  --scopes /subscriptions/<subscription-id>

# Output:
# AZURE_CLIENT_ID
# AZURE_CLIENT_SECRET
# AZURE_TENANT_ID
```

**Additional permissions needed:**

* `Microsoft.CognitiveServices/accounts/read` — list Azure OpenAI accounts
* `Microsoft.CognitiveServices/accounts/deployments/read` — list deployments
* Reader on Application Insights workspace

**Application Insights connection string** — for execution streaming:

```
AZURE_APPINSIGHTS_CONNECTION_STRING=InstrumentationKey=...;WorkspaceId=...
```

***

## What your developers do

Nothing for automatic monitoring.

For execution data to appear in Application Insights (which the connector reads), ensure your Azure OpenAI calls go through the Azure SDK with diagnostics enabled — this is the default when using `openai` Python SDK with Azure endpoint configuration.

For **precise checks** on critical agents:

```python theme={null}
import httpx, threading, uuid
from openai import AzureOpenAI

client = AzureOpenAI(
    azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
    api_key=os.environ["AZURE_OPENAI_KEY"],
    api_version="2024-02-01",
)

def run_agent(prompt: str) -> str:
    job_id = str(uuid.uuid4())
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": prompt}]
    )
    output = response.choices[0].message.content

    threading.Thread(target=lambda: httpx.post(
        f"{MUSTER_URL}/api/v1/jobs/{job_id}/quality",
        json={"agent_id": "azure-gpt4o-agent", "checks": [
            {"check_id": "output_not_empty", "severity": "HIGH", "passed": bool(output)},
        ]},
        timeout=2.0,
    ), daemon=True).start()

    return output
```
