Skip to content
Esc
↑↓navigate↵open⌘Jpreview
Start
On this page

Azure AI Foundry

Enterprise-grade AI models with Azure security, compliance, and regional data residency. Access OpenAI, Llama, Mistral, and more through Azure infrastructure.

What is the Autohand Azure AI Foundry integration?

The Autohand Azure AI Foundry integration connects the coding agent to a model deployment in your Azure environment. It uses the deployment endpoint and either an Azure API key or supported identity credentials.

Status Available
Requires An Azure AI Foundry resource, a deployed model, its endpoint, and an API key or supported Azure identity.
Configure with Set the Azure endpoint and credentials, name the deployed model, and select the Azure provider in your Autohand configuration.
Best for Organizations using Azure identity, network, compliance, and regional controls.

Overview

Azure AI Foundry (formerly Azure AI Studio) provides enterprise access to leading AI models. When integrated with Autohand, you get:

  • Access to GPT-4, GPT-4o, and OpenAI models on Azure
  • Open-source models like Llama 3.1, Mistral, and Phi
  • Enterprise security with API Key, Microsoft Entra ID, or Managed Identity
  • Data residency in your chosen Azure region
  • Azure’s own compliance certifications, which cover the Azure platform, not Autohand (see Microsoft’s compliance documentation)
  • Private endpoints and VNet integration

Setup

Get started with Azure AI Foundry.

Prerequisites

  • Azure subscription with AI Foundry access
  • Azure AI Foundry project created
  • Model deployment in your project

Get your credentials

  1. Go to ai.azure.com and sign in
  2. Open your AI Foundry project
  3. Navigate to Deployments and select your model
  4. Copy the endpoint URL and API key

Configure Autohand

# Set environment variables
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com"
export AZURE_OPENAI_KEY="xxxxxxxxxxxxxxxxxxxxxxxx"
export AZURE_OPENAI_DEPLOYMENT="gpt-4o"
export AZURE_OPENAI_API_VERSION="2024-10-21"

# Or use the interactive wizard
autohand
/model
# Select "azure" from the provider list and follow the prompts

Verify your configuration:

# Start with Azure provider
autohand --provider azure --model gpt-4o

# Test with a prompt
autohand --prompt "Hello, which model are you?"

CLI configuration

Configure Azure AI Foundry in your ~/.autohand/config.json. Autohand supports two styles: structured fields (recommended) or a direct base URL override.

{
  "provider": "azure",
  "azure": {
    "model": "gpt-4o",
    "apiKey": "your-azure-api-key",
    "resourceName": "your-resource",
    "deploymentName": "gpt-4o",
    "apiVersion": "2024-10-21",
    "authMethod": "api-key"
  }
}

Base URL override

For proxies, custom endpoints, or Azure AI Foundry model-as-a-service:

{
  "provider": "azure",
  "azure": {
    "model": "gpt-4o",
    "apiKey": "your-azure-api-key",
    "baseUrl": "https://your-resource.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21"
  }
}

Configuration options

Option Description Default
model Model name (for display and model switching) gpt-4o
apiKey Your Azure API key -
resourceName Azure resource name (from https://{name}.openai.azure.com) -
deploymentName Model deployment name in Azure -
apiVersion Azure OpenAI API version 2024-10-21
authMethod Authentication method: api-key, entra-id, or managed-identity api-key
baseUrl Full endpoint URL override (bypasses resourceName/deploymentName) -

Environment variables

All configuration options can be set via environment variables. These override values in config.json:

Variable Maps to
AZURE_OPENAI_KEY azure.apiKey
AZURE_OPENAI_ENDPOINT azure.baseUrl
AZURE_OPENAI_DEPLOYMENT azure.deploymentName
AZURE_OPENAI_API_VERSION azure.apiVersion
AZURE_TENANT_ID azure.tenantId
AZURE_CLIENT_ID azure.clientId
AZURE_CLIENT_SECRET azure.clientSecret

Authentication methods

Autohand supports three authentication methods for Azure OpenAI. Choose based on your security requirements.

API Key (default)

The simplest option. Use the API key from your Azure OpenAI resource.

{
  "provider": "azure",
  "azure": {
    "authMethod": "api-key",
    "apiKey": "your-azure-api-key",
    "resourceName": "your-resource",
    "deploymentName": "gpt-4o",
    "apiVersion": "2024-10-21"
  }
}

Microsoft Entra ID (Azure AD)

Use OAuth2 client credentials for enterprise environments. Requires an app registration in Microsoft Entra ID.

{
  "provider": "azure",
  "azure": {
    "authMethod": "entra-id",
    "tenantId": "your-tenant-id",
    "clientId": "your-client-id",
    "clientSecret": "your-client-secret",
    "resourceName": "your-resource",
    "deploymentName": "gpt-4o",
    "apiVersion": "2024-10-21"
  }
}

Managed Identity

For workloads running inside Azure (VMs, App Service, AKS, etc.). No credentials needed — Azure handles authentication automatically via the Instance Metadata Service (IMDS).

{
  "provider": "azure",
  "azure": {
    "authMethod": "managed-identity",
    "resourceName": "your-resource",
    "deploymentName": "gpt-4o",
    "apiVersion": "2024-10-21"
  }
}

Available models

Azure AI Foundry supports multiple model families.

OpenAI models

Model Context Best for
gpt-4o 128K Most capable, multimodal
gpt-4o-mini 128K Fast and cost-effective
gpt-4-turbo 128K Complex reasoning

Open-source models

Model Context Best for
Meta-Llama-3.1-70B 128K Open-source, flexible
Mistral-Large-2 128K Efficient reasoning
Phi-3-medium 128K Microsoft research model

Best practices

  • Use Managed Identity: Prefer managed identities over API keys for Azure-hosted production workloads.
  • Use Entra ID: For non-Azure environments, use Entra ID app credentials instead of API keys.
  • Choose your region: Deploy models in regions that meet your data residency requirements.
  • Monitor usage: Use Azure Cost Management to track AI spending.
  • Set quotas: Configure TPM (tokens per minute) limits to control costs.
  • Rotate API keys: If using API keys, rotate them regularly via the Azure portal.

Resources

Troubleshooting

Common issues

Issue Solution
401 Unauthorized Check API key or Azure AD credentials
404 Deployment not found Verify deployment name matches exactly
429 Rate limited Increase TPM quota in Azure portal
Region not available Deploy model in a supported region

Debug mode

# Enable verbose logging
AUTOHAND_DEBUG=true autohand --provider azure

# Test Azure endpoint directly
curl "https://your-resource.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-10-21" \
  -H "api-key: ${AZURE_OPENAI_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "Hello"}]}'
How do I configure the Autohand Azure AI Foundry integration?

Set the Azure endpoint and credentials, name the deployed model, and select the Azure provider in your Autohand configuration.

What does the Autohand Azure AI Foundry integration require?

An Azure AI Foundry resource, a deployed model, its endpoint, and an API key or supported Azure identity.

What limitations should I know about?

Model availability and features depend on the Azure deployment, API version, subscription, and region.

Last updated on

Was this helpful?

Send Feedback

Help us improve this documentation page. Your feedback is valuable.

We'll only contact you if we need clarification