๐ค Configure AI in X-AutoMate (Azure OpenAI)
To enable AI capabilities in X-AutoMate โ the assistant, SQL generation, the query translator, and MCP โ you need an LLM backend. This guide walks through deploying an Azure OpenAI model, retrieving the credentials, and wiring it into X-AutoMate.
๐ก You only need to do this once per environment. After it's configured, all AI features become available across the app.
โ Prerequisitesโ
- An active Azure subscription
- Access to Azure OpenAI Service (request access at https://aka.ms/oai/access if your subscription doesn't have it yet)
OwnerorContributorrole on the target resource group- (Optional) Azure CLI installed locally โ
brew install azure-cli
๐ Step 1: Create an Azure OpenAI Resourceโ
๐ ฐ Option A โ Azure Portalโ
- Sign in to https://portal.azure.com.
- Search for Azure OpenAI in the top search bar and select it.
- Click Create.
- Fill in the Basics tab:
- Subscription โ your subscription
- Resource group โ create a new one or pick existing (e.g.
rg-openai-prod) - Region โ choose a region that supports your model (e.g.
East US,Sweden Central,West Europe). Model availability varies by region โ see model availability docs - Name โ globally-unique name (e.g.
xam-openai-prod) - Pricing tier โ
Standard S0
- On Network, choose access type (public endpoint for quickstart; private endpoint for production).
- Add Tags if needed, then Review + create โ Create.
- Wait for deployment to finish, then click Go to resource.
๐ ฑ Option B โ Azure CLIโ
# Variables
RG="rg-openai-prod"
LOCATION="eastus"
NAME="xam-openai-prod"
# Create resource group (skip if it already exists)
az group create --name "$RG" --location "$LOCATION"
# Create the Azure OpenAI account
az cognitiveservices account create \
--name "$NAME" \
--resource-group "$RG" \
--location "$LOCATION" \
--kind OpenAI \
--sku S0 \
--yes
๐งฌ Step 2: Deploy a Modelโ
A deployment is a named instance of a base model (e.g. gpt-5.4-nano) that your application targets.
๐ ฐ Option A โ Azure AI Foundry (Portal)โ
- From the resource page, click Go to Azure AI Foundry portal (formerly Azure OpenAI Studio).
- In the left nav, select Deployments โ + Deploy model โ Deploy base model.
- Choose a model from the GPT-5 family, for example:
- โญ
gpt-5.4-nanoโ preferred for X-AutoMate: fastest and most cost-efficient, ideal for the assistant, SQL generation, and the query translator gpt-5.4-miniโ balanced speed and qualitygpt-5.4โ highest-quality reasoning, best for complex SQL generation taskstext-embedding-3-largeโ embeddings
- โญ
- Click Confirm, then configure:
- Deployment name โ friendly identifier you'll use in code (e.g.
gpt-5.4-nano-chat) - Model version โ pin a specific version or use Auto-update to default
- Deployment type:
Standardโ pay-per-token, regionalGlobal Standardโ pay-per-token, global capacity (highest throughput)Provisioned(PTU) โ reserved throughput for predictable latency
- Tokens per Minute Rate Limit (TPM) โ quota for this deployment
- Content filter โ default or a custom policy
- Deployment name โ friendly identifier you'll use in code (e.g.
- Click Deploy.
๐ ฑ Option B โ Azure CLIโ
DEPLOYMENT_NAME="gpt-5.4-nano-chat"
MODEL_NAME="gpt-5.4-nano"
MODEL_VERSION="2026-04-15"
az cognitiveservices account deployment create \
--name "$NAME" \
--resource-group "$RG" \
--deployment-name "$DEPLOYMENT_NAME" \
--model-name "$MODEL_NAME" \
--model-version "$MODEL_VERSION" \
--model-format OpenAI \
--sku-capacity 50 \
--sku-name "Standard"
๐ Step 3: Retrieve Endpoint and Keysโ
From the Portalโ
- Open the Azure OpenAI resource.
- In the left nav, select Keys and Endpoint.
- Copy:
- Endpoint โ e.g.
https://xam-openai-prod.openai.azure.com/ - KEY 1 (or KEY 2)
- Endpoint โ e.g.
From the CLIโ
# Endpoint
az cognitiveservices account show \
--name "$NAME" --resource-group "$RG" \
--query "properties.endpoint" -o tsv
# Keys
az cognitiveservices account keys list \
--name "$NAME" --resource-group "$RG"
๐งช Step 4: Test the Deploymentโ
Before wiring into X-AutoMate, give it a quick smoke test.
REST (curl)โ
ENDPOINT="https://xam-openai-prod.openai.azure.com"
DEPLOYMENT="gpt-5.4-nano-chat"
API_VERSION="2024-10-21"
API_KEY="<your-key>"
curl -X POST "$ENDPOINT/openai/deployments/$DEPLOYMENT/chat/completions?api-version=$API_VERSION" \
-H "Content-Type: application/json" \
-H "api-key: $API_KEY" \
-d '{
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hello from Azure OpenAI."}
],
"max_tokens": 100
}'
Python (openai SDK)โ
pip install openai
import os
from openai import AzureOpenAI
client = AzureOpenAI(
api_key=os.environ["AZURE_OPENAI_API_KEY"],
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
api_version="2024-10-21",
)
resp = client.chat.completions.create(
model="gpt-5.4-nano-chat", # <-- the DEPLOYMENT name, not the model name
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hello from Azure OpenAI."},
],
)
print(resp.choices[0].message.content)
๐ Step 5: Wire It into X-AutoMateโ
Once your Azure OpenAI deployment is ready, add the following environment variables to your X-AutoMate configuration.
โ Required Variablesโ
XAM_LLM_ENABLED=True
XAM_LLM_PROVIDER=azure
AZURE_INFERENCE_ENDPOINT="https://xam-openai-prod.openai.azure.com"
AZURE_INFERENCE_CREDENTIAL="<your-azure-openai-key>"
AZURE_API_VERSION="2024-10-21"
AZURE_CHAT_MODEL="gpt-5.4-nano-chat" # the DEPLOYMENT name, not the base model
โ๏ธ Optional Variablesโ
MAX_TOKENS=4096
STREAMING=True # True | False
AZURE_CHAT_MODEL should be your deployment name from Step 2 (e.g. gpt-5.4-nano-chat) โ not the base model name (e.g. gpt-5.4-nano). This is the most common configuration mistake.
๐ Step 6 (Recommended): Use Managed Identity Instead of Keysโ
API keys are convenient but harder to rotate and audit. For services running in Azure (App Service, AKS, Container Apps, VM), prefer Entra ID auth:
- Enable a system-assigned managed identity on the compute resource.
- On the OpenAI resource โ Access control (IAM) โ Add role assignment โ grant the identity the role Cognitive Services OpenAI User.
- In code, drop the API key and use
DefaultAzureCredential:
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
from openai import AzureOpenAI
token_provider = get_bearer_token_provider(
DefaultAzureCredential(),
"https://cognitiveservices.azure.com/.default",
)
client = AzureOpenAI(
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
azure_ad_token_provider=token_provider,
api_version="2024-10-21",
)
๐ Step 7: Monitoring and Quotaโ
- Metrics โ Resource โ Monitoring โ Metrics. Track Processed Inference Tokens, Generated Completion Tokens, throttled requests.
- Logs โ enable Diagnostic settings to send logs to Log Analytics.
- Quota โ AI Foundry โ Quotas. Increase TPM per deployment or request a subscription-level quota increase via support ticket.
- Cost โ Cost Management + Billing โ filter by the resource group. Pricing is per 1K input/output tokens and varies by model.
๐ Troubleshootingโ
| Symptom | Likely cause | Fix |
|---|---|---|
404 DeploymentNotFound | AZURE_CHAT_MODEL is the base model name instead of the deployment name | Use your deployment name (e.g. gpt-5.4-nano-chat) |
401 Unauthorized | Wrong key or wrong endpoint region | Re-check Keys and Endpoint blade |
429 Too Many Requests | TPM / RPM exceeded | Raise deployment capacity or switch to Global Standard |
Region does not support model | Selected region lacks that model SKU | Pick a supported region from the model availability matrix |
| Slow first response | Cold start on Standard tier | Use PTU / Provisioned deployment for steady low latency |
| AI features missing in X-AutoMate UI | XAM_LLM_ENABLED is False or unset | Set XAM_LLM_ENABLED=True and restart the app |
๐ Useful Referencesโ
๐ Summaryโ
| Step | What you do |
|---|---|
| 1 | Create an Azure OpenAI resource |
| 2 | Deploy a model from the GPT-5 family (preferred: gpt-5.4-nano) |
| 3 | Grab the endpoint and key |
| 4 | Smoke-test the deployment |
| 5 | Add XAM_LLM_* and AZURE_* env vars to X-AutoMate |
| 6 | (Recommended) switch to Managed Identity for production |
| 7 | Monitor TPM, quota, and cost |
๐ Next step: Once configured, head to the AI Assistant, MCP Integration, AI SQL Generation, or AI Query Translator pages to start using AI in X-AutoMate.