Azure OpenAI
Integrate Azure OpenAI deployments with ModelRed
Azure OpenAI Service
Test enterprise-grade OpenAI and custom models deployed on Azure with enhanced security, compliance, and regional deployment options.
Quick Setup
Get Started in 4 Steps
Connect your Azure OpenAI deployment for security testing.
Get Azure Resource Info
From your Azure Portal, collect your OpenAI resource details.
Endpoint: https://your-resource.openai.azure.com/
API Key: from Keys and Endpoint
Deployment: your-model-deployment
Set Environment Variables
export AZURE_OPENAI_API_KEY="your-azure-api-key"
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
export AZURE_OPENAI_DEPLOYMENT="gpt-4-deployment"
Register Your Model
from modelred import ModelRed
async with ModelRed() as client:
await client.register_azure_model(
model_id="my-azure-gpt4",
api_key="your-azure-api-key", # or use env var
endpoint="https://your-resource.openai.azure.com/",
deployment_name="gpt-4-deployment"
)
Run Security Test
# Test your Azure deployment
result = await client.run_assessment(
model_id="my-azure-gpt4",
test_suites=["basic_security"]
)
print(f"🔍 Assessment: {result.assessment_id}")
Popular Deployments
GPT-3.5 Turbo
Cost-effective for development and testing
GPT-4
Best reasoning for production systems
GPT-4 Turbo
Large context for document analysis
Configuration Options
Advanced Setup
Additional configuration options for Azure deployments.
Multiple Deployments
# Register different Azure deployments
deployments = [
("azure-gpt35", "gpt-35-turbo"),
("azure-gpt4", "gpt-4"),
("azure-gpt4-turbo", "gpt-4-turbo")
]
for model_id, deployment in deployments:
await client.register_azure_model(
model_id=model_id,
endpoint="https://your-resource.openai.azure.com/",
deployment_name=deployment
)
Custom API Version
await client.register_azure_model(
model_id="azure-gpt4-custom",
endpoint="https://your-resource.openai.azure.com/",
deployment_name="gpt-4",
api_version="2024-02-15-preview",
metadata={
"region": "eastus",
"environment": "production"
}
)
Enterprise Features
🏢 Azure Advantages
Security & Compliance
Private network deployment
Customer-managed encryption keys
SOC 2, HIPAA, ISO compliance
Regional data residency
Enterprise Management
Azure AD integration
Role-based access control
Usage analytics & billing
Common Issues
⚠️ Troubleshooting
Invalid Endpoint
ConnectionError: Invalid endpoint URL
- • Check endpoint format: https://your-resource.openai.azure.com/
- • Verify resource name in Azure Portal
- • Ensure resource is deployed and active
Deployment Not Found
DeploymentNotFound: The model deployment 'gpt-4' not found
- • Check deployment name in Azure OpenAI Studio
- • Ensure deployment is successfully created
- • Verify deployment status is 'Succeeded'
Access Denied
Unauthorized: Access denied
- • Verify API key from Keys and Endpoint section
- • Check network restrictions and firewall rules
- • Ensure correct Azure subscription
Quick Test
✅ Verify Your Setup
Run this test to confirm your Azure OpenAI integration is working:
import asyncio
from modelred import ModelRed
async def test_azure():
async with ModelRed() as client:
# Register Azure model
await client.register_azure_model(
model_id="test-azure",
endpoint="https://your-resource.openai.azure.com/",
deployment_name="gpt-35-turbo"
)
print("✅ Azure OpenAI model registered!")
# Run security test
result = await client.run_assessment(
model_id="test-azure",
test_suites=["basic_security"]
)
print(f"🔍 Assessment started: {result.assessment_id}")
asyncio.run(test_azure())