Generative AI on Azure

Generative AI connects model concepts, prompt design, grounding, Azure services, and responsible AI controls into one practical workload story.

What generative AI actually is

Know the workload pattern before you memorize products.

Generative AI produces new content: text, code, images, summaries, search answers, or chat responses. Traditional AI patterns usually return a label, number, group, or prediction. For AI-900, keep it simple: generative AI creates an artifact from learned patterns and prompt instructions.

TaskInputOutputExample
ClassificationKnown example with featuresA category or labelMark an email as spam or not spam.
RegressionKnown example with numeric patternsA numberPredict next month’s sales revenue.
ClusteringUnlabeled examplesGroups of similar itemsGroup customers by buying behavior.
Generative AIA prompt plus optional contextNew generated contentDraft a reply, summarize a file, or create an image.

If the requirement says “generate,” “draft,” “rewrite,” “summarize,” “create,” or “answer in natural language,” think generative AI.

Text generation

Create emails, descriptions, policies, learning content, or customer responses.

Summarization

Condense documents, meetings, tickets, transcripts, or search results.

Code generation

Produce code, tests, scripts, explanations, and refactoring suggestions.

Image generation

Create or edit images from text prompts.

Chat and copilots

Hold a conversation that follows instructions and helps users complete tasks.

Agents that call tools

Use a model to decide when to call APIs, search, databases, or workflows.

Language generation relies on the Transformer architecture from skill area 2. Transformers represent relationships between tokens, so they can generate text, answer questions, translate language, write code, and use conversation context.

Exam shortcut

If the answer is a new document, message, image, code block, summary, or chat response, think generative AI. If the answer is a label or number, think classification or regression.

Models, tokens, and the shape of a request

Understand what is sent to the model and what controls the output.

A large language model is a foundation model trained on enormous text collections to predict useful continuations. You send a prompt; the model returns a completion. Chat apps package prompts as messages: system instructions, the user request, prior turns, and grounding data.

A token is a chunk of text: a word, word part, punctuation mark, or whitespace. For example, the sentence Azure AI helps students prepare. might split roughly as Azure AI helps students prepare .. The exact split depends on the model.

Tokens matter twice

Tokens are what you are billed for and what fills the context window. Long prompts, chat history, retrieved passages, and long answers all consume tokens.

The context window is the maximum text the model can consider: instructions, prompt, history, retrieved content, tool outputs, and completion. Facts outside the window cannot be used reliably.

Multi-modal models accept more than one input type. A common example is text plus images, such as asking about a screenshot or diagram. Choose the model family that matches the input and output.

Model familyWhat it doesTypical use
GPT modelsGenerate and transform natural language and code.Chat, copilots, summarization, drafting, reasoning over supplied context, and code assistance.
Embedding modelsConvert text into numeric vectors that capture meaning.Semantic search, similarity comparison, clustering text, and retrieval augmented generation.
DALL-EGenerate images from text prompts.Illustrations, design concepts, marketing images, and visual brainstorming.
WhisperConvert speech audio into text.Transcription, captions, meeting notes, and voice-driven workflows.

Inference settings affect the current response; they do not train the model.

SettingWhat it controlsExam-friendly interpretation
TemperatureHow random or creative token selection is.Lower temperature gives more deterministic, repeatable output. Higher temperature gives more variety, not more accuracy.
Top-pThe probability mass of candidate tokens considered.Higher top-p allows a wider set of possible next tokens. Lower top-p narrows the choices.
Max tokensThe maximum length of the completion.Use it to cap cost, latency, and answer length.
Stop sequencesText patterns that tell generation to stop.Use them when you need a response to end at a delimiter or before another section begins.
Do not overthink top-p

AI-900 usually expects the high-level idea: temperature and top-p affect randomness. They are not responsible AI filters, data sources, or training settings.

Prompt engineering

Use instructions, examples, and context before changing the model.

Prompt engineering means writing instructions that steer the model toward the desired output. It is the cheapest lever because it changes the request, not the model or infrastructure. Good prompts reduce ambiguity.

The system message is the highest-level instruction in many chat apps. It defines role, boundaries, tone, allowed sources, format, safety rules, and what to do when information is missing. Put durable behavior there, not one-time user details.

Weak prompt: Write something about the outage.

Strong rewrite: You are a customer support analyst. Write a 120-word status update for nontechnical retail store managers. Use only the incident notes below. Include impact, current workaround, next update time, and a calm tone. If a detail is missing, write “not yet confirmed.”

Specific prompts name the audience, task, format, constraints, and source material. Replace “make this better” with the exact output you want.

Prompt typeMeaningWorked example
Zero-shotNo example is provided.“Classify this support ticket as Billing, Technical, Account, or Other.”
One-shotOne example shows the pattern.“Example: ‘My invoice is wrong’ → Billing. Now classify: ‘I cannot reset my password.’”
Few-shotSeveral examples teach the desired pattern.“Invoice issue → Billing; error code → Technical; password reset → Account. Now classify this ticket.”

Examples help enforce style or structure. Few-shot prompts can often fix format problems without fine-tuning. Chain-of-thought style prompts ask the model to explain reasoning or show steps. In practice, ask for a concise rationale, evidence, assumptions, or calculation steps so users can review the answer.

You can include source material directly in short prompts. Paste the policy, email, ticket, or passage and tell the model to answer only from that text. For large content libraries, use retrieval augmented generation instead of stuffing everything into the prompt.

Prompt pattern

Role + task + audience + source + format + constraints + fallback. That pattern answers most prompt-engineering questions on the exam.

Grounding, RAG, and fine-tuning

This is the highest-value generative AI decision area.

Grounding means giving the model trusted information to use when it answers. The model does not automatically know your current policies, contracts, tickets, inventory, or private documents. Grounding connects responses to supplied facts.

Retrieval augmented generation, or RAG, is the key grounding pattern. It combines search with generation by retrieving relevant content at request time and placing it in the prompt.

RAG end to end

  1. Your documents are split into useful chunks and indexed, commonly in Azure AI Search.
  2. The user asks a question.
  3. The question is converted into an embedding, a numeric vector that represents meaning.
  4. Azure AI Search finds relevant passages using vector search, keyword search, or hybrid search.
  5. The passages are inserted into the prompt, and the model answers from them with citations when configured.

RAG reduces hallucination because authoritative context is in the prompt. It also keeps answers current without retraining: update the index, and the next retrieval can use the new passage. That is very different from fine-tuning, which changes behavior but is not a knowledge-refresh strategy.

Fine-tuning trains a model further on curated examples. It can teach tone, format, domain phrasing, or a narrow task when prompting and grounding cannot produce a consistent pattern. It requires prepared data, evaluation, and more cost.

Fine-tuning is bad for changing knowledge. If the assistant must answer from a handbook, catalog, policy, contract library, or knowledge base, choose RAG. Private or domain-specific data does not automatically mean fine-tuning.

ApproachWhat it changesCost and effortBest forNot for
Prompt engineeringThe instructions, examples, format, and context sent in a request.Lowest cost and fastest to change.Improving clarity, tone, format, and task instructions.Large private knowledge bases or behavior the prompt cannot reliably enforce.
Retrieval augmented generationThe information retrieved and inserted into the prompt at answer time.Medium effort: indexing, chunking, search, ranking, and citations.Answering from current documents, policies, tickets, and enterprise data.Changing the model’s core style or teaching a repeatable output pattern by example.
Fine-tuningThe model’s learned response behavior for a task.Highest effort: curated labeled data, training, evaluation, and deployment.Consistent tone, format, and narrow specialized behavior after other methods fail.Keeping facts current, replacing search, or storing private documents in the model.
The ladder

Try prompt engineering first, then grounding with RAG, and only fine-tune when the first two cannot get you there.

Hallucinations are plausible but false, unsupported, or invented statements. They happen because the model predicts likely text; confident tone is not proof. Mitigate them with trusted grounding, lower temperature, and instructions to say it does not know when context is insufficient. For high-risk decisions, add human review and citations.

Classic exam trap

Embeddings support retrieval. They do not rewrite the model’s weights. Fine-tuning changes learned behavior. RAG changes the context supplied at generation time.

Azure AI Foundry, Azure OpenAI, and the model catalog

Know which Azure service does which job.

Azure OpenAI Service gives Azure customers access to OpenAI models through Azure security, networking, regional availability, monitoring, quota, and governance. You create a model deployment before calling a model so the app has a named endpoint tied to a model version and capacity configuration.

Quota is commonly described in tokens per minute and requests per minute. Long prompts with retrieved content can hit token quota quickly. The Azure OpenAI “on your data” capability wires an Azure AI Search index into a chat deployment for RAG. The model generates the answer; Azure AI Search supplies passages.

Azure AI Foundry is the portal and development environment for generative AI apps on Azure. It provides hubs, projects, model playgrounds, prompt flow, and evaluations for quality, groundedness, relevance, risk, and safety. The Azure AI Foundry model catalog contains OpenAI models and open models from other providers. Serverless API deployment is pay per token with no infrastructure. Managed compute means you provision and pay for the compute that hosts the model.

Azure AI Content Safety detects and filters risky content. It covers hate, sexual, violence, and self-harm categories with severity levels, plus prompt shields for jailbreak and indirect prompt injection attempts, groundedness detection, and protected material detection.

Service or featureWhat it isUse it when
Azure OpenAI ServiceAzure-hosted access to OpenAI models with enterprise controls.You need GPT, embeddings, DALL-E, or Whisper capabilities in an Azure app.
Model deploymentA named deployment of a selected model version.Your app needs an endpoint and Azure-governed capacity.
Tokens per minute quotaA capacity limit based on prompt and completion tokens.You estimate throughput, cost, scaling, and rate limits.
Azure OpenAI on your dataA built-in RAG path that connects chat to Azure AI Search.You want grounded chat over documents with less custom retrieval code.
Azure AI FoundryA portal and project environment for generative AI apps.You want model experiments, prompt flow, evaluations, and project assets.
Azure AI Foundry playgroundsInteractive places to try models and prompts without code.You need to compare prompts or demo a model quickly.
Prompt flowA way to design, connect, test, and evaluate multi-step generative workflows.Your app needs retrieval, prompt construction, model calls, and post-processing.
EvaluationsTools for measuring quality and safety of outputs.You need repeatable checks for relevance, groundedness, coherence, risk, and regression.
Azure AI Foundry model catalogA catalog of OpenAI and open models.You need to discover, compare, and deploy models.
Serverless API deploymentA pay-per-token endpoint with no infrastructure to manage.You want simple consumption-based access to supported catalog models.
Managed compute deploymentA deployment where you provision compute to host a model.You need more control and accept paying for provisioned infrastructure.
Azure AI SearchSearch and indexing for keyword, vector, and hybrid retrieval.You build RAG over enterprise documents or knowledge bases.
Azure AI Content SafetySafety service for harmful content, attacks, groundedness, and protected material.You need policy enforcement around prompts and completions.
Azure Machine LearningML platform for training, MLOps, and custom workflows.You need broader ML lifecycle management.
Azure AI VisionService for image analysis and computer vision.You need OCR, image analysis, or object detection.
Azure AI LanguageService for sentiment, key phrases, and entity recognition.You need classic language analysis rather than open-ended generation.
Azure AI SpeechService for speech to text, text to speech, and translation.You need speech input, voice output, transcription, or spoken interaction.
Service boundary

Azure AI Foundry is not just Azure Machine Learning studio with a new name. For AI-900, associate Foundry with generative AI projects, playgrounds, catalog models, prompt flow, and evaluations.

Responsible generative AI

Safety is part of the workload, not an afterthought.

Microsoft describes a four-stage process for responsible generative AI: identify potential harms, measure them, mitigate them, and operate responsibly. Keep doing it after release because model and user behavior can change.

StageWhat you doGenerative AI example
IdentifyList ways the system could cause harm.Wrong medical advice, leaked confidential data, offensive output, unsafe automation, or fabricated citations.
MeasureTest how often harms appear and under which prompts.Run evaluations with normal prompts, adversarial prompts, edge cases, and protected-class scenarios.
MitigateReduce risk at several layers.Use model choice, content filters, system messages, grounding, prompt shields, output validation, and human review.
OperateRelease and monitor responsibly.Use a release plan, logging, user feedback, incident response, and rollback procedures.

Mitigation is layered: choose an appropriate model, use Azure AI Content Safety and filters, define refusal rules in the system message, ground with trusted data and citations, and design the user experience with warnings and confirmations.

Responsible AI principleGenerative AI meaning
FairnessOutputs should not create unfair treatment or reinforce harmful bias across groups.
Reliability and safetyThe system should behave consistently, handle failures, and avoid unsafe recommendations.
Privacy and securityPrompts, completions, retrieved documents, and logs must be protected and governed.
InclusivenessThe experience should work for people with different abilities, languages, and contexts.
TransparencyUsers should know they are interacting with AI and understand limitations, sources, and uncertainty.
AccountabilityPeople and organizations remain responsible for design, deployment, monitoring, and decisions.

Content filters can block or annotate harmful prompts and responses. Thresholds are configurable by severity, but production apps still need safety controls that match risk. Use human oversight when outputs affect people, money, health, legal obligations, employment, or safety. Be transparent that content is AI-generated and may need source verification.

Unrestricted prompts are risky

If users can type anything and the system can answer or call tools without guardrails, the app is exposed to jailbreaks, prompt injection, data leakage, and unsafe actions.

Where people lose points here

Memorize the contrasts, not just the names.
TrapCorrect exam answer
Choosing fine-tuning when the scenario needs current company documents.Use grounding with RAG, usually with Azure AI Search.
Thinking higher temperature makes answers more accurate.Higher temperature increases variety. Lower temperature is more deterministic.
Confusing embeddings with fine-tuning.Embeddings convert text to vectors for similarity and retrieval. Fine-tuning changes model behavior.
Assuming Azure OpenAI trains on your prompts or business data.Azure OpenAI Service does not train OpenAI models on your data by default.
Confusing Azure AI Foundry with Azure Machine Learning studio.Foundry is the generative AI app platform with projects, model catalog, playgrounds, prompt flow, and evaluations.
Confusing model catalog deployment choices.Serverless API is pay per token with no infrastructure. Managed compute uses provisioned compute.
Treating content filters as optional.Safety filters and responsible AI mitigations are expected parts of production generative AI.
Most common miss

If the data must be fresh, cited, or sourced from your documents, choose RAG. Fine-tuning is not a knowledge-base refresh strategy.

Second most common miss

Azure AI Search does not generate the final natural language answer. It retrieves the most relevant passages. The generative model writes the answer from those passages.

The night-before cheat sheet

Fast recall for exam day.

Generative scenarios

Text generation drafts content. Rewriting changes tone or style. Summarization condenses content. Code generation writes or explains code. Image generation creates visuals. Chat and copilots converse. Agents call tools to act.

Model families

GPT is for text, chat, and code. Embeddings turn text into vectors. DALL-E generates images. Whisper converts speech to text. Multi-modal models can accept more than text.

Generation settings

Temperature controls randomness. Low temperature is more repeatable. High temperature is more varied. Top-p controls the candidate token pool. Max tokens caps output length. Stop sequences end generation at a pattern.

The improvement ladder

First improve the prompt. Next add grounding with RAG. Only then consider fine-tuning for consistent style, format, or narrow behavior that examples and grounding cannot solve.

RAG in five stepsRemember it as
1. Index trusted content.Documents become searchable chunks.
2. Embed the user question.The question becomes a vector for semantic matching.
3. Retrieve relevant passages.Azure AI Search finds the best matches.
4. Add passages to the prompt.The model receives facts at answer time.
5. Generate an answer with citations.The model writes from grounded context.
Azure itemOne-line recall
Azure OpenAI ServiceOpenAI models hosted in Azure with enterprise controls.
Azure AI FoundryBuild, test, evaluate, and manage generative AI apps.
Model catalogFind and deploy OpenAI and open models.
Azure AI SearchIndex and retrieve content for RAG.
Azure AI Content SafetyDetect harmful content, jailbreaks, groundedness issues, and protected material.

Responsible AI process: identify harms → measure harms → mitigate harms → operate responsibly. Map every generative AI system to fairness, reliability and safety, privacy and security, inclusiveness, transparency, and accountability.

Final memory hook: Prompt for behavior, RAG for facts, fine-tune for a specialized pattern, and content safety for guardrails.