Ask Mentors Anything

Get your questions/doubts directly answered by our mentors. Let's get started.

Mentee Question

Asked by Devesh srivastava

How would you design and deploy a production-grade AI application on Azure? Please explain the common challenges around architecture, security, authentication, RAG, vector databases, monitoring, logging, scalability, CI/CD, performance, cost optimisation, Azure AI services, networking, and disaster recovery, along with the best practices and real-world solutions for each.

Mentors Answer

Answered By Mentor Praveen Kumar

LLM is an unreliable, rate-limited, expensive dependency. Design around it.


Architecture

  • Problem: one monolith doing ingestion and serving.
  • Fix: separate the two. Put APIM in front of every model call. Keep the app stateless. Use Container Apps by default; AKS only if you need GPUs or self-hosted models.

Security

  • Problem: prompt injection, especially hidden inside retrieved documents.
  • Fix: treat retrieved content as untrusted. Use Prompt Shields. Give tools least-privilege identities. Red-team with PyRIT before launch.

Auth

  • Problem: User A gets answers grounded in User B's documents. This is the most common serious enterprise RAG bug.
  • Fix: Entra ID for users, Managed Identity for services, API keys disabled. Store ACLs on every chunk and filter at query time.

RAG

  • Problem: "the model is wrong" usually means retrieval is wrong.
  • Fix: Document Intelligence for parsing, structure-aware chunking, hybrid search plus semantic reranker, query rewriting, citations. Build a golden evaluation set. Without one, you're guessing.

Vector DB

  • AI Search is the default. Use Cosmos DB if vectors should live next to app data, pgvector if you're already on Postgres.
  • Version your embeddings and use blue/green indexes. Quantize large indexes.

Monitoring

  • Problem: APM shows the request was slow but not why, and says nothing about answer quality.
  • Fix: OpenTelemetry traces across the whole chain into App Insights. Track tokens, time-to-first-token, 429s, and cost per request. Sample production traffic for groundedness scoring.

Logging

  • Problem: you need prompts for debugging, but they contain PII.
  • Fix: redact before persisting. Log chunk IDs, not chunk content. Use Basic log tiers for volume and short retention.

Scalability

  • Problem: your limit is model quota (TPM), not compute.
  • Fix: PTU first, spill over to pay-as-you-go, then a second region, all through APIM. Respect retry-after. Queue long jobs and use the Batch API. Autoscale on queue depth or concurrency, not CPU.

CI/CD

  • Problem: prompts get edited in the portal and quality drops without anyone noticing.
  • Fix: IaC for everything. Version prompts in Git. Gate the pipeline on evaluation scores. Pin model versions. Canary new models.

Performance

  • Stream responses.
  • Use small models for routing and query rewriting, big models only for the final answer.
  • Put static prompt content first so prefix caching applies.
  • Add a semantic cache.
  • Send 5 chunks, not 20.

Cost

  • Problem: the bill grows with nobody accountable.
  • Fix: emit tokens per team from APIM and charge back. Then apply model tiering, caching, Batch API, and PTU only at steady high utilization. Set token budgets. Kill runaway agent loops.

Azure AI Services

  • Don't use an LLM for OCR, PII detection, or language detection. Use Document Intelligence, AI Language, and Content Safety. The LLM is for reasoning.

Networking

  • Hub-and-spoke, Private Endpoints everywhere, centralized Private DNS zones. DNS causes 90% of the breakage.
  • Shared Private Links for AI Search. Egress through the firewall with an allowlist. Self-hosted build agents inside the VNet.

Disaster Recovery

  • Model endpoints are regional. Deploy in multiple regions behind APIM.
  • AI Search doesn't geo-replicate: run two indexes or accept the rebuild time.
  • Keep source documents and Cosmos DB geo-redundant. Everything in IaC. Run failover drills, because a DR plan you haven't tested probably won't work.



Top Performing Mentors This Week 🔥

Loading...

400+

Book a Free Trial with any mentor of your choice

Book a Free Trial