Skip to main content

Challenge 20: Azure OpenAI Service

Estimated Time

25-30 min | Cost: Free | Domain: Generative AI (15-20%)

Exam skills covered

  • Identify features and capabilities of Azure OpenAI Service
  • Describe Azure OpenAI models (GPT-4, GPT-3.5, DALL-E, Whisper)
  • Identify Azure OpenAI endpoints and deployments

Overview

Azure OpenAI Service provides access to OpenAI's powerful language models (GPT-4, GPT-4o, GPT-3.5-Turbo), image generation (DALL-E), and audio transcription (Whisper) through Azure's enterprise-grade cloud platform. It combines OpenAI's cutting-edge AI capabilities with Azure's security, compliance, networking, and responsible AI features.

Unlike using OpenAI directly, Azure OpenAI provides enterprise benefits: your data remains within Azure's compliance boundary, you get Azure Active Directory (Microsoft Entra ID) authentication, private network connectivity, content filtering built in, and regional availability with SLA guarantees. This makes it suitable for production workloads in regulated industries.

To use Azure OpenAI, you first create an Azure OpenAI resource, then deploy specific models within it. Each deployment gets its own endpoint that applications call. You can have multiple deployments (different models or same model with different settings) within a single resource. The Azure OpenAI Studio (now part of Azure AI Foundry) provides a playground for testing prompts before integrating them into applications.

Explore

Task 1: Understand Azure OpenAI models

Azure OpenAI offers several model families for different use cases:

ModelCapabilitiesBest For
GPT-4oText + vision, fastest GPT-4 class modelGeneral-purpose chat, multimodal (text + image)
GPT-4Advanced reasoning, complex tasksComplex analysis, creative writing, long-form content
GPT-4 TurboLarge context window (128K tokens)Processing long documents, detailed instructions
GPT-3.5-TurboFast, cost-effective text generationSimple chat, content generation, classification
DALL-EImage generation from text descriptionsCreating illustrations, concept art, design mockups
WhisperAudio transcription (speech-to-text)Meeting transcription, subtitle generation
Text Embedding modelsConvert text to vector representationsSemantic search, document similarity

Task 2: Explore the Azure OpenAI Studio Playground

The Azure OpenAI Studio Playground (accessible at oai.azure.com) lets you interact with deployed models. Here's what you'd see:

Chat Playground interface: Challenge 20 - Chat Completion Structure

Key playground components:

  • System message — Instructions that define the AI's behavior and persona
  • Temperature — Controls randomness (0-2, default ~0.7)
  • Max tokens — Maximum length of the response
  • Top-p — Alternative randomness control (0-1)
  • Deployment — Which deployed model to use

Task 3: Understand deployments and endpoints

Azure OpenAI uses a deployment model to manage access:

Challenge 20 - Azure OpenAI Resource Structure

Key concepts:

  • Resource — The Azure resource that holds your deployments
  • Deployment — A specific model instance with its own name and endpoint
  • Endpoint — The URL applications call to access the model
  • API key / Microsoft Entra auth — Authentication methods for accessing deployments

Endpoint structure:

https://{resource-name}.openai.azure.com/openai/deployments/{deployment-name}/chat/completions?api-version=2024-02-01

Task 4: Compare Chat Completions vs. Completions

Azure OpenAI provides different API patterns:

APIFormatUse Case
Chat CompletionsMessages array (system, user, assistant roles)Conversational AI, most modern use cases
Completions (legacy)Single prompt textSimple text completion
EmbeddingsInput text → vector arraySearch, similarity, clustering
Images (DALL-E)Text description → imageImage generation
Audio (Whisper)Audio file → textTranscription

Chat Completions message format (the most common pattern):

{
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is Azure?"},
{"role": "assistant", "content": "Azure is Microsoft's cloud..."},
{"role": "user", "content": "Tell me about pricing."}
]
}

The roles are:

  • system — Sets the AI's behavior/persona (hidden from user)
  • user — The human's messages
  • assistant — The AI's previous responses (for multi-turn context)
Azure CLI Alternative
# Create an Azure OpenAI resource
az cognitiveservices account create \
--name my-openai-resource \
--resource-group myResourceGroup \
--kind OpenAI \
--sku S0 \
--location eastus2

# List available models for deployment
az cognitiveservices account list-models \
--name my-openai-resource \
--resource-group myResourceGroup \
--output table

Key Concepts

ConceptDefinition
Azure OpenAI ServiceAzure-hosted access to OpenAI models with enterprise security and compliance
DeploymentA specific model instance within an Azure OpenAI resource with its own endpoint
System messageInstructions that define the AI assistant's behavior, persona, and constraints
TokenThe basic unit of text processing (~¾ of a word); determines cost and context limits
Chat Completions APIThe message-based API format using system/user/assistant roles
Content filteringBuilt-in Azure OpenAI feature that blocks harmful content in inputs and outputs

Common Misconceptions

MisconceptionReality
Azure OpenAI and OpenAI's API are identicalAzure OpenAI adds enterprise features (compliance, networking, content filters, Entra ID auth) not available in OpenAI's direct API
You can use any model immediately without deploymentYou must deploy a model before you can use it — deployments create the endpoint your application calls
GPT-4 is always better than GPT-3.5 for every taskGPT-3.5 is faster and cheaper; for simple tasks (classification, extraction) it may be sufficient and more cost-effective
Azure OpenAI stores and trains on your dataBy default, Azure OpenAI does NOT use your data to retrain models; your data stays within your compliance boundary
DALL-E and GPT use the same model architectureDALL-E uses diffusion models for image generation; GPT uses transformer models for text — they are different architectures

Knowledge Check

1. What must you create before applications can access an Azure OpenAI model?

2. Which Azure OpenAI model would you use to generate images from text descriptions?

3. What is the purpose of the "system message" in Azure OpenAI Chat Completions?

4. What is a key benefit of using Azure OpenAI Service instead of OpenAI's direct API?

5. Which Azure OpenAI model is best suited for transcribing a recorded meeting into text?

Learn More