Back to exam

AI-103 Cheatsheet

Developing AI Apps and Agents on Azure

Download free PDF

Plan, deploy, and secure AI services

Model and service selection

  • **Microsoft Foundry projects** organize agents, connections, evaluations, and application development. A project connection centralizes an external resource's endpoint and authentication configuration; permissions on the target resource still apply.
  • **Chat and reasoning models** generate responses; **embedding models** map text to numeric vectors for similarity search. Choose multimodal models when inputs include images or audio, and specialized generation models for images or video.
  • Compare candidate models on **task quality, latency, throughput, context capacity, and cost** using representative workloads. A **model cascade** routes routine requests to a smaller model and escalates difficult requests to a more capable model.
  • **RAG** supplies selected external knowledge at inference time. **Fine-tuning** changes learned behavior through examples; it does not replace a governed retrieval layer for frequently changing private documents.

Deployment, capacity, and residency

  • **Standard** deployments use consumption-based capacity; **provisioned throughput** reserves model processing capacity. Managed or serverless inference avoids operating model-serving VMs; customer-managed compute has separate infrastructure and quota responsibilities.
  • **Global**, **Data Zone**, and geography-based deployment types have different processing boundaries. For an EU processing requirement with consumption billing, assess **Data Zone Standard** in a supported EU location; selecting an EU resource alone does not constrain a global deployment.
  • A **deployment name** identifies the endpoint's deployed model configuration. Keep it distinct from the model family and model version when configuring SDK requests.
  • Pin the **model version** and select an appropriate upgrade policy for repeatability. Track retirement and test replacement versions; version pinning is not a promise of indefinite availability.

Identity, roles, and connections

  • **Microsoft Entra ID** supports keyless access. Use **managed identity** for Azure-hosted workloads and an Azure Identity credential such as **DefaultAzureCredential** for supported development and deployment environments.
  • Authentication obtains a token; **authorization** requires the correct role at the correct scope. **Cognitive Services OpenAI User** permits supported Azure OpenAI inference; a successful CLI sign-in alone does not grant inference access.
  • Assign project access through **Entra security groups** and separate development, testing, and administration duties. Use the narrowest project or resource scope and grant data-plane permissions separately where needed.
  • Configure a shared **Azure AI Search connection** for reusable search settings. For keyless retrieval, authorize the identity actually used by the agent or application on the search resource; a connection does not bypass RBAC.
  • Give tool execution a dedicated identity where isolation is required. Grant **Key Vault Secrets User** for reading secret values and **Storage Blob Data Reader** for read-only blob access, scoped to the required resource or container.

Network and resource operations

  • **Private endpoints** provide private connectivity; configure private DNS and disable or restrict public access as required. **Service endpoints and network rules** restrict access to supported subnets while retaining the service endpoint model.
  • **Azure AI Search roles** separate query access, document updates, and service administration. Use **Search Index Data Reader** for queries and supported narrow resource scopes when restricting applications to particular indexes.
  • Where keys remain necessary, distinguish **query keys** from powerful administrative keys. Revoke a compromised query key and update clients; use overlapping primary and secondary credentials for planned rotation where the service supports them.
  • **ARM/Bicep** defines resources and connections reproducibly. In deployment scripts, **az cognitiveservices account show** retrieves an existing account's properties; keep management operations separate from inference calls.
  • A **multi-service AI resource** consolidates supported service access and billing. **Customer-managed keys** protect supported stored data; configure the resource identity, key permissions, and network reachability together.

Build agents, tools, and workflows

Instructions and model requests

  • **System instructions** establish the agent's role, permitted subject matter, response style, and behavior when evidence is missing. **Few-shot examples** demonstrate expected classifications or formats; zero-shot prompts provide no worked examples.
  • Lower **temperature** generally reduces variability on models that support sampling controls. **Top-p** changes the sampling pool; neither parameter guarantees identical wording. Use semantic or schema-based validation for generated answers.
  • **Output token limits** bound generation and can cause truncation. More output capacity does not ensure that required clauses are included; validate coverage explicitly. Use model-supported reasoning controls separately from sampling settings.
  • Supply the **endpoint, deployment name, and credential** expected by the inference client. The Azure OpenAI **Responses API** and Chat Completions have different request shapes; match content types and parameters to the API being called.
  • **Structured outputs** constrain responses to a supported JSON Schema; JSON mode only ensures valid JSON. Define required properties and **additionalProperties: false** on objects, and validate the result before business actions.
  • A **required nullable field** must appear but may contain null. A required array may be empty unless the schema enforces an applicable length constraint; required presence does not ensure useful business content.

Tool contracts and execution

  • **Function tools** describe callable actions and their argument schemas. The application validates arguments, authorizes the operation, executes the function, and returns its result for further reasoning.
  • **OpenAPI 3.0 tools** expose HTTP operations. Define an **apiKey security scheme** with the required header name, apply its security requirement, and bind the tool to the project connection holding the credential.
  • **MCP** exposes tools through a common protocol. Treat server descriptions and returned content as untrusted inputs; restrict reachable servers, validate results, and audit action execution.
  • **tool_choice: auto** allows the model to skip tools; **required** requires tool use where supported. To mandate one particular tool, use the API's supported specific-tool selector. Required tool use alone does not guarantee the correct source was queried.
  • **Code interpreter** supports calculations and file processing; **file search** retrieves uploaded document content; web grounding retrieves current public information. Select curated private retrieval when responses must use only organizational sources.

Conversation state and memory

  • A durable **conversation ID** associates successive turns with stored messages and tool interactions. Reuse the ID for the same support case; do not reconstruct full history from only the last assistant response.
  • **Conversation history** records interactions; **long-term memory** retains selected facts or preferences across conversations. Memory is not a substitute for the complete conversation audit trail or an authoritative knowledge repository.
  • Isolate memory using a trusted **user scope** for personalization or a **conversation scope** for session continuity. Where supported, the memory search tool's **{{$userId}}** resolves authenticated user scope; low-level memory APIs require explicit scoping.
  • Apply **retention, deletion, access control, and consent** to stored conversations and memories. Limit recalled information and context size; never use a client-supplied user identifier alone as proof of authorization.

Deterministic orchestration and approval

  • **Workflows** define ordered steps, conditions, and shared state across agents. Use explicit branches for predictable triage and optional actions; group chat permits more model-directed coordination.
  • **Human approval** pauses execution before a consequential action such as a refund. Resume the action only after approval, and validate the approved arguments again at execution time.
  • In **Power Fx**, **IsBlank** tests a blank value and **Upper** converts text to uppercase. Use the workflow's correct variable scope and typed expression syntax when reading a stored answer.
  • Enforce mandatory retrieval as a **workflow step** before generation. Limit retries and tool loops, set timeouts, and make side-effecting operations idempotent to avoid duplicate actions.

Ground responses with enterprise data

Retrieval and vector fundamentals

  • **Embeddings** encode semantic relationships as numeric vectors. Embed document chunks and queries with compatible models, dimensions, and preprocessing; **cosine similarity** compares vector direction rather than exact wording.
  • **Keyword search** suits precise terms and product codes. **Vector search** finds semantic similarity. **Hybrid search** combines both; **semantic ranking** reranks candidates and does not create embeddings.
  • **Classic RAG** retrieves context and then generates an answer. **Agentic retrieval** can use conversation context to plan multiple subqueries and execute searches in parallel for complex questions.
  • Tune **chunk size, overlap, retrieval count, filters, and ranking** against a test set. Too little context misses evidence; excessive or irrelevant context consumes tokens and can weaken answers.

Indexing and enrichment

  • An Azure AI Search **data source** defines the source; an **indexer** ingests content; a **skillset** enriches it; the **index** stores queryable fields. Inspect indexer status and failure history when content is missing.
  • **Text Split** creates manageable chunks and an **Azure OpenAI Embedding** skill generates vectors. Configure vector field dimensions, a vector search profile, and compatible query vectorization.
  • For embedded images in supported document indexers, image extraction can create a **normalized_images** collection. Feed these images to **OCR**, then merge or map extracted text into searchable content.
  • **Document Layout** extraction preserves structural information and location metadata. Use structure-aware parsing for headings and multipage tables, and retain file, page, section, and location metadata for citations.
  • **Index projections** map enriched chunks into search documents. A **knowledge store** persists enrichment outputs separately: object projections retain JSON, table projections provide structured rows, and file projections retain extracted images.

Authorized evidence and citations

  • **Document-level filtering** stores allowed user or group identifiers in filterable index fields. Resolve the authenticated user's memberships and apply a server-controlled filter to every retrieval request.
  • A search credential authorizes access to the service or index; it does not automatically enforce every document's business permissions. Filter before content enters the prompt, and prevent client changes to the authorization filter.
  • Preserve **source IDs, URLs, page numbers, and chunk relationships** through ingestion. Return citations tied to retrieved evidence; a citation marker alone does not prove that a claim is supported.
  • Reingest documents when improved parsing or chunking is needed. Validate extraction quality and retrieval before changing the generation prompt; the model cannot recover table structure that ingestion discarded.

Apply safety, evaluation, and observability

Layered content controls

  • **Content Safety** classifies harmful content such as hate, sexual content, violence, and self-harm. Configure severity thresholds for the modality and policy; image moderation and text moderation examine different inputs.
  • **Prompt Shields for user prompts** address direct attacks; **document attack detection** addresses instructions inside lower-trust retrieved content, tool output, or extracted image text. Delimit untrusted data and keep it below system instructions.
  • **Image moderation** detects harmful visual content; it does not by itself neutralize embedded instructions. Apply injection defenses to OCR text or supported multimodal document inputs before reasoning.
  • **PII detection and redaction** reduce exposure of sensitive data. Combine ingestion controls, retrieval permissions, output inspection, and limited logging; a safety prompt alone cannot guarantee that customer information never leaks.
  • **Protected material detection** identifies supported protected text or code patterns. **Blocklists** match configured terms. These controls serve different purposes from injection detection, PII redaction, and harmful-content classification.

Guardrails and responsible operation

  • Guardrails can inspect **user input, tool calls, tool responses, and final output** where the runtime and tool support the intervention. To prevent sensitive or harmful data leaving for a tool, check it before tool execution.
  • **Tool-call authorization** and approval are separate from content moderation. Restrict tool permissions and destinations even when the proposed arguments pass a content filter.
  • **Transparency** explains AI use and data processing. **Fairness** examines uneven impacts; **inclusiveness** supports diverse needs; **privacy and security** protect data; **reliability and safety** and **accountability** guide operation and oversight.
  • Use **human review** for consequential decisions, ambiguous extractions, and safety exceptions. Confidence and sentiment scores are evidence to assess, not automatic authority for employment or financial decisions.

Quality and safety evaluation

  • **Groundedness** checks whether response claims are supported by supplied context. **Relevance** checks whether the response addresses the query; **retrieval evaluation** checks the quality of retrieved evidence against the task or labeled context.
  • **Response completeness** checks coverage of expected information. **Coherence** measures logical organization and **fluency** measures language quality; fluent answers can still be unsupported or incomplete.
  • Use representative datasets with **query, context, response, and ground truth** as required by the evaluators. Map columns correctly, compare candidate changes, and inspect failures alongside aggregate scores.
  • **Risk and safety evaluation** measures harmful content and other supported risks such as protected material or sensitive-data exposure. A defect rate depends on the chosen severity threshold; compare rates under equivalent configurations.
  • Add a **reflection or evaluate-and-retry pass** before returning answers that require specific clauses. Check omissions against retrieved evidence, regenerate with feedback, and stop or escalate when bounded retries fail.
  • In **CI/CD**, trigger evaluation on pull requests, provide the project endpoint and evaluation configuration, and fail the job when thresholds are missed. Require the resulting status check in branch protection to block merging.
  • **Fine-tuning data safety checks** are distinct from inference-time content filtering. Changing an inference filter threshold does not clean unsafe training examples or guarantee that training validation will pass.

Tracing, monitoring, and reliability

  • **Tracing** shows the ordered spans of model calls, retrieval, tools, and exceptions for an individual request. **Monitoring** aggregates traffic, failures, latency, and resource consumption over time.
  • Connect **Application Insights** and instrument external Python services with **OpenTelemetry** or supported framework callbacks. Propagate trace context and use service or instrumentation attributes to distinguish components sharing the same telemetry resource.
  • Treat **content recording** as an explicit data-handling choice. Redact secrets and sensitive fields from prompts, tool arguments, results, and span attributes before recording; disabling content recording does not sanitize custom attributes.
  • Inspect **input tokens, output tokens, tool usage, and per-step latency** when cost rises without more traffic. Trace retrieval misses separately from model failures; an empty result does not establish that the model is unavailable.
  • For **HTTP 429**, honor retry guidance and use bounded exponential backoff with jitter, concurrency limits, and quota-aware traffic shaping. For **HTTP 400** size errors, reduce or split supported uploads; retries do not change request limits.

Extract documents and analyze language

OCR, layout, and invoice extraction

  • **OCR/Read** extracts text; **layout analysis** preserves tables, paragraphs, headings, and document positions. Plain OCR alone is insufficient when downstream reasoning depends on rows or reading order.
  • **Document Intelligence** combines document structure with extraction models. The **prebuilt invoice model** extracts invoice fields and line items across supported layouts without training a custom model.
  • Use the **layout model** with **output_content_format=ContentFormat.MARKDOWN** in supported Document Intelligence SDKs to preserve document structure for downstream processing.
  • Long-running document or Read requests return an operation or poller. Wait for **succeeded**, stop on **failed**, and use delayed polling; receiving an operation ID does not mean analysis has completed.

Content Understanding analyzers

  • **Content Understanding** transforms documents, images, audio, or video into structured outputs. Define an **analyzer** with the required field names, types, descriptions, and extraction behavior for the business task.
  • Distinguish **prebuilt-read**, **prebuilt-layout**, document search preparation, and field extraction analyzers. Read targets text, layout retains structure, and field schemas define the business values to return; availability depends on the API and analyzer.
  • **Standard** single-document processing suits high-volume extraction. **Pro** task configurations add reasoning across multiple documents and reference data where supported; compare invoices, purchase orders, and contracts in a coordinated validation pipeline.
  • Enable supported **field source and confidence estimation** when reviewers need provenance and routing scores. Preserve source locations and send results below the business threshold for review; search relevance scores are not extraction confidence.
  • For video analysis, **segmentation** groups temporal content. Define generated fields, such as a segment's color scheme, at the intended scope and retain timestamps for navigation and review.

Entities, privacy, and sentiment

  • **Named entity recognition** extracts categories such as Person, Organization, Location, and DateTime. In the Text Analytics client, **recognize_entities** uses prebuilt NER; custom NER requires a labeled schema and training.
  • **PII recognition** detects sensitive entities and returns supported redacted text. Restrict **piiCategories** to **Person** when only names should be masked; validate category behavior on representative inputs.
  • For **custom NER**, define distinct labels with clear boundaries. Split a broad ContactInfo label into phone, email, and social-handle types when that better represents the task, then relabel consistently and retrain.
  • **Sentiment analysis** reports positive, neutral, or negative sentiment with confidence scores. **Opinion mining** links sentiment to specific aspects; **key phrase extraction** identifies salient phrases rather than entities or sentiment.

Translation, accessibility, and local processing

  • **Translator** handles text or document translation. Split code-switched text into coherent single-language segments when one source-language choice cannot represent the whole input; preserve order when recombining results.
  • **Immersive Reader** supplies reading assistance such as read-aloud and visual comprehension aids. Choose accessibility features around user needs and supported languages.
  • Supported **AI service containers** keep inference near local data. Configure the image, service-specific settings, **EULA acceptance, billing endpoint, and credential**; local inference does not imply disconnected licensing or zero outbound communication.

Build vision, speech, and media experiences

Image analysis and custom vision

  • **Image analysis** provides supported tags, captions, object locations, and OCR. Distinguish image descriptions from image classification and image type detection; request the features and language the selected API supports.
  • **Classification** labels an entire image. **Multiclass** selects mutually exclusive categories; **multilabel** allows several labels. **Object detection** locates individual items with bounding boxes for counting or defect localization.
  • A custom vision workflow is **label images, train, evaluate, publish, and predict**. Add new labeled examples and train a new iteration when products change; keep test data separate from training.
  • **Precision = TP / (TP + FP)** measures the reliability of positive predictions. **Recall = TP / (TP + FN)** measures how many true objects are found. Threshold changes trade false positives against missed detections.
  • For supported **Custom Vision exports**, use a compatible **compact domain**, retrain, and export to the target runtime such as Core ML for iOS. Validate exported performance on the actual device and offline workload.

Multimodal requests and generation

  • Send images as **typed content parts**, not as a URL buried in plain text. Chat Completions commonly uses **text** and **image_url** parts; Responses uses its corresponding input content types.
  • **Text-to-image** creates images from prompts; **image editing** uses an input image. Supported **high input fidelity** settings can preserve product appearance more closely, but require visual validation.
  • **Mask-based inpainting** targets a selected region, such as a background logo, with the original image, mask, and edit instruction. Mask conventions and preservation guarantees depend on the image model.
  • **Video generation** produces clips from supported prompts and reference inputs. Submit the job, check status, retrieve the completed asset, and review safety, brand consistency, and visual artifacts before use. Use dedicated media editing for precise postproduction changes.

Speech recognition and synthesis

  • **Real-time speech-to-text** transcribes streaming calls with low delay. **Batch transcription** processes recorded files. **Text-to-speech** generates spoken responses; speech translation converts spoken content into another language.
  • **Custom Speech** adapts recognition to domain audio or terminology. Keep the Speech resource, project, model, deployment, and endpoint identifiers distinct; schedule model replacement before its support or endpoint lifecycle ends.
  • **SSML phoneme** specifies pronunciation; **say-as** controls interpretation of values such as dates or digits; **prosody** controls rate, pitch, and volume. Select supported voices, locales, and speaking styles.
  • For supported **Speech Entra authentication**, configure the resource's custom subdomain, obtain a token for the expected audience, and grant an appropriate Speech data role. Private networking is a separate access control.

Real-time voice and media analysis

  • **Realtime audio models** support streaming voice interaction. **WebRTC** is suited to browser or mobile low-latency media; **WebSocket** is common for server-side streaming. Select transport around the application and service support.
  • Implement **voice activity detection, turn boundaries, interruption, and cancellation** for natural dialogue. Speech recognition plus synthesis alone does not guarantee correct barge-in or safe behavior when speech overlaps.
  • **Video Indexer** extracts insights from recorded media. Live zone-entry detection, production-line inspection, and periodic PPE checks require an appropriate video or image pipeline, representative validation, and supported deployment capabilities.