Skip to main content

๐Ÿค– 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)
  • Owner or Contributor role 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โ€‹

  1. Sign in to https://portal.azure.com.
  2. Search for Azure OpenAI in the top search bar and select it.
  3. Click Create.
  4. 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
  5. On Network, choose access type (public endpoint for quickstart; private endpoint for production).
  6. Add Tags if needed, then Review + create โ†’ Create.
  7. 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)โ€‹

  1. From the resource page, click Go to Azure AI Foundry portal (formerly Azure OpenAI Studio).
  2. In the left nav, select Deployments โ†’ + Deploy model โ†’ Deploy base model.
  3. 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 quality
    • gpt-5.4 โ€” highest-quality reasoning, best for complex SQL generation tasks
    • text-embedding-3-large โ€” embeddings
  4. 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, regional
      • Global 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
  5. 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โ€‹

  1. Open the Azure OpenAI resource.
  2. In the left nav, select Keys and Endpoint.
  3. Copy:
    • Endpoint โ€” e.g. https://xam-openai-prod.openai.azure.com/
    • KEY 1 (or KEY 2)

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
๐Ÿ’ก Tip

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.


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:

  1. Enable a system-assigned managed identity on the compute resource.
  2. On the OpenAI resource โ†’ Access control (IAM) โ†’ Add role assignment โ†’ grant the identity the role Cognitive Services OpenAI User.
  3. 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โ€‹

SymptomLikely causeFix
404 DeploymentNotFoundAZURE_CHAT_MODEL is the base model name instead of the deployment nameUse your deployment name (e.g. gpt-5.4-nano-chat)
401 UnauthorizedWrong key or wrong endpoint regionRe-check Keys and Endpoint blade
429 Too Many RequestsTPM / RPM exceededRaise deployment capacity or switch to Global Standard
Region does not support modelSelected region lacks that model SKUPick a supported region from the model availability matrix
Slow first responseCold start on Standard tierUse PTU / Provisioned deployment for steady low latency
AI features missing in X-AutoMate UIXAM_LLM_ENABLED is False or unsetSet XAM_LLM_ENABLED=True and restart the app

๐Ÿ“š Useful Referencesโ€‹


๐Ÿ“Œ Summaryโ€‹

StepWhat you do
1Create an Azure OpenAI resource
2Deploy a model from the GPT-5 family (preferred: gpt-5.4-nano)
3Grab the endpoint and key
4Smoke-test the deployment
5Add XAM_LLM_* and AZURE_* env vars to X-AutoMate
6(Recommended) switch to Managed Identity for production
7Monitor 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.