Azure OpenAI Service Intermediate
Azure OpenAI Service provides enterprise access to OpenAI's most powerful models — GPT-4, GPT-4o, DALL-E 3, and Whisper — with Azure's security, compliance, and regional availability. Your data is not used to train models, and all traffic stays within your Azure subscription.
Available Models
| Model | Type | Use Cases |
|---|---|---|
| GPT-4o | Multi-modal (text + vision) | Chat, analysis, reasoning, image understanding |
| GPT-4 | Text generation | Complex reasoning, coding, content creation |
| GPT-3.5 Turbo | Text generation | Fast chat, summarization, classification |
| DALL-E 3 | Image generation | Creating images from text descriptions |
| Whisper | Speech-to-text | Audio transcription, translation |
| Text Embedding | Embeddings | Semantic search, RAG, clustering |
Creating a Deployment
Terminal
# Create an Azure OpenAI resource az cognitiveservices account create \ --name my-openai-resource \ --resource-group ai-school-rg \ --kind OpenAI \ --sku S0 \ --location eastus # Deploy a GPT-4o model az cognitiveservices account deployment create \ --name my-openai-resource \ --resource-group ai-school-rg \ --deployment-name gpt-4o-deployment \ --model-name gpt-4o \ --model-version "2024-05-13" \ --model-format OpenAI \ --sku-capacity 10 \ --sku-name Standard
Using the Chat Completions API
Python
from openai import AzureOpenAI client = AzureOpenAI( api_key="YOUR_API_KEY", api_version="2024-02-01", azure_endpoint="https://my-openai-resource.openai.azure.com/" ) # Chat completion response = client.chat.completions.create( model="gpt-4o-deployment", # Your deployment name messages=[ {"role": "system", "content": "You are a helpful AI assistant."}, {"role": "user", "content": "Explain Azure OpenAI in 3 sentences."} ], temperature=0.7, max_tokens=500 ) print(response.choices[0].message.content)
Image Generation with DALL-E 3
Python
# Generate an image result = client.images.generate( model="dall-e-3", prompt="A futuristic city powered by AI, digital art style", size="1024x1024", quality="hd", n=1 ) image_url = result.data[0].url print(f"Image URL: {image_url}")
Speech-to-Text with Whisper
Python
# Transcribe audio with open("audio.mp3", "rb") as audio_file: transcription = client.audio.transcriptions.create( model="whisper-deployment", file=audio_file, language="en" ) print(transcription.text)
Enterprise Features
- Content Filtering: Built-in content safety filters for hate speech, violence, sexual content, and self-harm with configurable severity levels
- Private Endpoints: Access Azure OpenAI over private network connections within your VNet
- Managed Identity: Authenticate without API keys using Azure AD managed identities
- Rate Limiting: Configurable tokens-per-minute (TPM) and requests-per-minute (RPM) limits per deployment
- Data Residency: Choose from multiple Azure regions to keep data within specific geographies
Azure OpenAI vs OpenAI API: The APIs are nearly identical — you use the same
openai Python library. The key differences are: Azure requires a deployment name instead of a model name, uses Azure-specific authentication, and adds enterprise features like content filtering and private networking.
Models Deployed!
You can now use GPT-4, DALL-E, and Whisper through Azure. Next, explore Azure Machine Learning Studio for building custom ML models.
Next: ML Studio →
Lilly Tech Systems