Wednesday

Azure - Financial Services Application with RAG and AgenticAI

I would make the Azure version slightly more advanced than the AWS/GCP versions because Azure now has a particularly strong enterprise story around Microsoft Foundry + Agent 365 + Entra + Defender + Purview.

I also want to update two terms in your original architecture for interview accuracy:

  • Use “Microsoft Foundry” / “Microsoft Foundry Agent Service” rather than treating the older Azure AI Foundry naming as the whole platform.

  • “Agent 365” is now a real enterprise control plane for discovering, governing, securing and managing agents across Microsoft and third-party ecosystems. It became generally available for the commercial segment on May 1, 2026. (Microsoft Learn)

  • Azure API Management now has dedicated AI Gateway capabilities, including token quotas, semantic caching, model routing/governance and MCP management. The dedicated AI Gateway tier is currently preview, so for production architecture I would distinguish the generally available APIM AI-gateway capabilities from the preview tier. (Microsoft Learn)

  • Azure AI Search now also has “agentic retrieval” and underpins Foundry IQ, Microsoft's managed, permission-aware knowledge layer for agents. (Microsoft Learn)

1. Business scenario

We'll use exactly the same financial-services problem:

“Investigate why counterparty ABC breached its exposure limit yesterday and recommend what action should be taken.”

The solution needs:

                    FINANCIAL AI PLATFORM

        ┌────────────────────────────────────────┐
        │                                        │
        │  Unstructured Knowledge                │
        │  ├── Risk policies                     │
        │  ├── Regulatory documents              │
        │  ├── Credit policies                   │
        │  └── Procedures                        │
        │                                        │
        │  Structured Data                       │
        │  ├── Trades                            │
        │  ├── Exposure                          │
        │  ├── Limits                            │
        │  ├── P&L                               │
        │  └── Risk metrics                      │
        │                                        │
        │  Enterprise Tools                      │
        │  ├── Risk APIs                         │
        │  ├── Trade APIs                        │
        │  ├── Workflow                          │
        │  └── Microsoft 365                     │
        │                                        │
        └────────────────────────────────────────┘

This is therefore:

RAG
+
Agentic AI
+
Enterprise Data
+
Enterprise Tools
+
Security
+
Governance
+
Observability

2. Complete Azure architecture

                              USERS
                                │
                                ▼
                    ┌─────────────────────┐
                    │ Azure Application    │
                    │ Gateway + WAF        │
                    └──────────┬──────────┘
                               │
                         Azure Firewall
                        / Egress Control
                               │
                               ▼
                  ┌─────────────────────────┐
                  │ Azure App Service       │
                  │ / Container Apps / AKS  │
                  │                         │
                  │ API                     │
                  │ UI                      │
                  │ Orchestrator            │
                  └───────────┬─────────────┘
                              │
                              ▼
                 ┌──────────────────────────┐
                 │ Azure API Management     │
                 │ AI Gateway               │
                 │                          │
                 │ Auth                     │
                 │ Rate limits              │
                 │ Token quotas             │
                 │ Model routing            │
                 │ Semantic caching         │
                 │ Cost tracking            │
                 │ MCP governance           │
                 └────────────┬─────────────┘
                              │
                 ┌────────────┼──────────────┐
                 │            │              │
                 ▼            ▼              ▼
          Microsoft        Azure AI        Agent
          Foundry          Search          Tools
                 │            │              │
                 │            │              ├── Functions
                 │            │              ├── Logic Apps
                 │            │              ├── APIs
                 │            │              ├── SQL
                 │            │              └── MCP
                 │            │
                 ▼            ▼
          Foundry Models   RAG / Vector
          / Model Catalog   / Hybrid Search
                 │
                 ▼
           Foundry Agent
               Service
                 │
                 ▼
            Model Armor /
          Content Safety
                 │
                 ▼
          Human Approval
                 │
                 ▼
               USER

Security and governance wrap around the entire architecture:

Entra ID
   │
   ├── Identity
   ├── RBAC
   └── Managed Identity

Agent 365
   │
   ├── Agent inventory
   ├── Governance
   ├── Ownership
   ├── Lifecycle
   └── Risk controls

Defender
   │
   ├── Threat detection
   └── Runtime protection

Purview
   │
   ├── Data governance
   ├── Classification
   └── Compliance

Private Endpoints
   │
   └── Private connectivity

3. Perimeter

The request first hits:

Internet
   │
   ▼
Azure Application Gateway
   │
   ▼
WAF
   │
   ├── SQL injection
   ├── XSS
   ├── malicious payloads
   ├── IP rules
   └── HTTP attacks
   │
   ▼
Backend

For a larger global architecture I would consider:

Azure Front Door
        │
        ▼
Application Gateway
        │
        ▼
Regional workload

That gives:

Global traffic management
+
Regional ingress
+
WAF
+
Application routing

4. Compute layer

Your original proposal uses App Service.

That is perfectly reasonable for:

Frontend
REST APIs
Lightweight orchestration
Stateless services

But for a senior architect interview, explain the alternatives:

                    Azure Compute
                         │
          ┌──────────────┼──────────────┐
          ▼              ▼              ▼
     App Service    Container Apps     AKS
          │              │              │
       Simple          Serverless      Complex
       APIs            containers      Kubernetes

My decision:

App Service
   ↓
Simple enterprise web/API application

Container Apps
   ↓
Microservices + event-driven agents

AKS
   ↓
Complex Kubernetes platform,
GPU/custom models,
advanced scheduling

For our architecture:

Application Gateway
        │
        ▼
Azure Container Apps / App Service
        │
        ├── API
        ├── UI
        └── Orchestration

And use AKS only where justified.


5. Azure API Management as AI Gateway

This is one of the most important parts.

Do not allow:

App
 │
 ├────► Gemini
 ├────► Claude
 ├────► GPT
 └────► other models

Instead:

                 Applications
                      │
                      ▼
              Azure API Management
                    AI Gateway
                      │
          ┌───────────┼───────────┐
          │           │           │
       Security     Routing      Cost
          │           │           │
          ▼           ▼           ▼
        IAM       Model choice  Tokens
                      │
          ┌───────────┼───────────┐
          ▼           ▼           ▼
       Foundry      Azure       External
        Models      OpenAI       Models

Azure APIM's current AI gateway capabilities include token rate limiting, semantic caching, model routing/governance and support for model APIs from multiple providers. (Microsoft Learn)


6. Token governance

Imagine three departments:

Risk
Compliance
Research

Without a gateway:

Risk
  │
  └── consumes entire model quota

Compliance
  │
  └── 429 errors

Research
  │
  └── 429 errors

APIM solves this with token-aware policies.

Conceptually:

Risk
   │
   ▼
100K TPM

Compliance
   │
   ▼
50K TPM

Research
   │
   ▼
25K TPM

Azure API Management supports token limits based on consumers such as subscription keys or arbitrary policy keys. (Microsoft Learn)


7. Semantic caching

This is particularly useful for enterprise assistants.

User asks:

“What is the counterparty limit policy?”

Another user asks:

“What is the approved exposure limit policy for counterparties?”

The prompts aren't identical but may be semantically equivalent.

Instead of:

Request
 ↓
LLM
 ↓
expensive inference

we can have:

Request
 ↓
Semantic Cache
 │
 ├── HIT ──► cached response
 │
 └── MISS
       ↓
      LLM

Azure APIM supports semantic caching with Azure Managed Redis or another compatible external cache. (Microsoft Learn)


8. Microsoft Foundry

Now we reach the AI platform.

Conceptually:

                 Microsoft Foundry
                       │
       ┌───────────────┼────────────────┐
       │               │                │
       ▼               ▼                ▼
     Models          Agents          Evaluation
       │               │                │
       ▼               ▼                ▼
    Model Catalog   Agent Service     Testing

Foundry becomes the AI engineering platform.

The architecture is:

Developer
   │
   ▼
Foundry
   │
   ├── Model selection
   ├── Agent development
   ├── Tools
   ├── Evaluation
   ├── Deployment
   └── Monitoring

9. Foundry Agent Service

The agent receives:

"Investigate ABC exposure breach."

It can:

PLAN
 ↓
retrieve information
 ↓
call tools
 ↓
reason
 ↓
retrieve more information
 ↓
validate
 ↓
recommend action

Architecture:

                     USER
                       │
                       ▼
                Foundry Agent
                    Service
                       │
                 ┌─────┴─────┐
                 │   Planner │
                 └─────┬─────┘
                       │
        ┌──────────────┼──────────────┐
        ▼              ▼              ▼
      RAG            Tools          APIs
        │              │              │
        ▼              ▼              ▼
 AI Search        Functions      Enterprise
                                  systems

10. Agent state

Your original proposal uses Cosmos DB.

That's a good architectural choice.

                    Agent
                      │
                      ▼
                 Cosmos DB
                      │
       ┌──────────────┼──────────────┐
       ▼              ▼              ▼
 conversation      state          metadata
 history

Example:

{
  "conversation_id": "abc-123",
  "user_id": "u-987",
  "tenant_id": "bank-a",
  "agent": "risk-investigator",
  "state": {
    "counterparty": "ABC",
    "exposure": 125000000,
    "limit": 100000000,
    "breach": 25000000
  }
}

But I would separate:

Conversation state
       ↓
Cosmos DB

Financial source of truth
       ↓
PostgreSQL / Fabric / Databricks / core systems

Never make agent memory the financial system of record.


11. RAG

Now the knowledge layer.

Documents:

Azure Blob Storage
│
├── Credit Policy.pdf
├── Market Risk Policy.pdf
├── Counterparty Policy.pdf
├── Basel Regulations.pdf
└── Internal Procedures.pdf

Pipeline:

                 Blob Storage
                      │
                      ▼
                Azure AI Search
                      │
          ┌───────────┼───────────┐
          ▼           ▼           ▼
        Chunk       Embed       Metadata
          │           │           │
          └───────────┼───────────┘
                      ▼
                Search Index
                      │
           ┌──────────┼──────────┐
           ▼          ▼          ▼
        Keyword     Vector     Hybrid
        Search      Search     Search

Azure AI Search currently supports vector, keyword, hybrid and multimodal search. (Microsoft Learn)


12. Hybrid search

Don't rely exclusively on vector search.

For financial applications:

User:

"Find policy CR-1024 regarding
BBB- rated counterparties."

The exact identifier:

CR-1024

is better handled by lexical search.

But:

"What happens if the counterparty's
credit quality deteriorates?"

is better suited to semantic retrieval.

Therefore:

                 Query
                   │
          ┌────────┴────────┐
          ▼                 ▼
     Keyword Search    Vector Search
          │                 │
          └────────┬────────┘
                   ▼
             Hybrid ranking
                   │
                   ▼
             Top documents

Azure AI Search explicitly supports hybrid vector + keyword queries. (Microsoft Learn)


13. Agentic retrieval

This is an important newer Azure capability.

Instead of a simplistic:

question
 ↓
vector search
 ↓
documents

agentic retrieval can reason about the retrieval process itself.

Conceptually:

User Question
      │
      ▼
Retrieval Agent
      │
      ├── Understand question
      ├── Break into subqueries
      ├── Search
      ├── Filter
      ├── Rank
      └── Produce evidence
             │
             ▼
          Main Agent

Azure AI Search documentation now includes agentic retrieval and identifies Azure AI Search as the foundation for Foundry IQ's permission-aware knowledge layer. (Microsoft Learn)


14. Security-aware RAG

This is critical for banking.

Suppose:

Consultant A
   ↓
Client A

Consultant B
   ↓
Client B

The search index contains:

{
  "document_id": "DOC-123",
  "tenant_id": "BANK-A",
  "classification": "CONFIDENTIAL",
  "business_unit": "MARKET_RISK"
}

The retrieval request must incorporate authorization context.

User
 │
 ▼
Entra ID
 │
 ▼
Claims
 │
 ├── tenant
 ├── role
 ├── region
 └── classification
 │
 ▼
Azure AI Search
 │
 ▼
Authorized results

Azure AI Search supports role-based access approaches, and current Microsoft documentation emphasizes permission-aware retrieval through the Foundry IQ knowledge layer. (Microsoft Learn)


15. Microsoft Entra ID

Entra becomes the identity backbone.

                    Entra ID
                       │
        ┌──────────────┼──────────────┐
        ▼              ▼              ▼
      Users          Agents         Services
        │              │              │
        ▼              ▼              ▼
      RBAC       Agent Identity    Managed Identity

Avoid:

API_KEY = "xxxxxxxx"

Prefer:

Managed Identity
        │
        ▼
Entra
        │
        ▼
Azure resource

This eliminates unnecessary secret distribution.


16. Azure Agent 365

This is where your Azure architecture becomes substantially different from AWS/GCP.

Think of Agent 365 as the enterprise agent control plane.

                  Agent 365
                      │
       ┌──────────────┼─────────────────┐
       ▼              ▼                 ▼
   Inventory       Governance        Security
       │              │                 │
       ▼              ▼                 ▼
 Agent registry   Policies          Threat detection
 Ownership        Permissions       Runtime protection
 Lifecycle         Compliance       Risk

Microsoft describes Agent 365 as a centralized control plane for discovering, managing, governing and securing agents across Microsoft and third-party ecosystems. (Microsoft Learn)


17. Agent lifecycle

This is an excellent interview concept.

              CREATE
                │
                ▼
             TEST
                │
                ▼
           EVALUATE
                │
                ▼
            APPROVE
                │
                ▼
           REGISTER
                │
                ▼
            DEPLOY
                │
                ▼
            MONITOR
                │
                ▼
             AUDIT
                │
                ▼
            RETIRE

Agent 365 provides governance capabilities around onboarding, ownership, activation, blocking and lifecycle management. (Microsoft Learn)


18. Agent identity

A modern Azure architecture should treat an agent as an identity-bearing enterprise entity.

Human
 │
 ▼
Entra Identity
 │
 ▼
Agent
 │
 ▼
Agent Identity
 │
 ├── permissions
 ├── owner
 ├── environment
 ├── risk classification
 └── allowed tools

Then:

Risk Agent
   │
   ├── READ exposure
   ├── READ policies
   ├── READ trades
   └── REQUEST approval

NOT:

   ├── DELETE trades
   ├── change credit limit
   └── transfer money

19. Defender

Add Microsoft Defender around runtime security.

Agent
 │
 ▼
Defender
 │
 ├── threat detection
 ├── malicious behavior
 ├── suspicious activity
 └── runtime protection

Microsoft's current Agent 365 security model integrates Defender capabilities for continuous threat detection and runtime protection. (Microsoft Learn)


20. Purview

Purview answers a different question:

"What data is this, who is allowed to access it, and what compliance rules apply?"

Architecture:

                  Microsoft Purview
                         │
        ┌────────────────┼────────────────┐
        ▼                ▼                ▼
   Classification     Lineage         Compliance
        │                │                │
        ▼                ▼                ▼
  Confidential       Data flow       Policies
  PII                dependencies
  Financial

For a financial-services GenAI platform:

Agent
 ↓
Data request
 ↓
Purview classification/governance
 ↓
Authorized data

21. Model safety

Use the current Microsoft AI safety stack rather than relying on one control.

Conceptually:

USER
 │
 ▼
APIM
 │
 ▼
Input safety
 │
 ▼
Foundry Agent
 │
 ▼
Model
 │
 ▼
Output safety
 │
 ▼
APIM
 │
 ▼
USER

For interview purposes, distinguish:

Application security
        ↓
WAF / Firewall / Entra

Data security
        ↓
Purview / RBAC / Private Endpoint

AI safety
        ↓
Content safety / model safety controls

Agent security
        ↓
Agent 365 / Defender

LLM grounding
        ↓
Azure AI Search / RAG / citations

Don't claim that any single component "prevents hallucinations."


22. Data architecture

Now incorporate your Microsoft data stack.

                         DATA PLATFORM
                              │
          ┌───────────────────┼────────────────────┐
          │                   │                    │
          ▼                   ▼                    ▼
     Microsoft Fabric     Databricks          Operational DBs
          │                   │                    │
          ▼                   ▼                    ▼
       OneLake            Lakehouse          PostgreSQL
          │                   │                    │
          └───────────────────┼────────────────────┘
                              ▼
                       Agent / Analytics

I would use Fabric for:

Enterprise analytics
OneLake
Power BI
Data integration
Governed analytics

Databricks for:

Advanced data engineering
Spark
ML workloads
Existing Databricks estate

PostgreSQL for:

Transactional application data
Agent metadata
Business services

Cosmos DB for:

Agent state
Conversation history
High-scale JSON/session data

Redis for:

Semantic cache
Session cache
Hot data
Rate-related state

23. Microsoft Fabric

For your financial architecture:

                  Microsoft Fabric
                        │
        ┌───────────────┼─────────────────┐
        ▼               ▼                 ▼
     OneLake         Data Factory       Power BI
        │               │                 │
        ▼               ▼                 ▼
 Historical         Pipelines          Executive
 financial data                       dashboard

Then:

Agent
 │
 ├── RAG → AI Search
 │
 └── Analytics → Fabric

This is a powerful separation.


24. Agent tools

Define deterministic tools.

async def get_counterparty_exposure(
    counterparty_id: str
):
    ...


async def get_counterparty_limit(
    counterparty_id: str
):
    ...


async def get_recent_trades(
    counterparty_id: str,
    hours: int
):
    ...


async def search_risk_policy(
    question: str
):
    ...


async def create_risk_case(
    counterparty_id: str,
    reason: str
):
    ...

The agent gets capabilities, not unrestricted access.


25. Azure Functions

Functions are ideal for short deterministic operations.

Agent
 │
 ▼
Azure Function
 │
 ├── Validate
 ├── Calculate
 ├── Transform
 ├── Call API
 └── Return result

Example:

def calculate_breach(exposure, limit):

    breach = max(exposure - limit, 0)

    return {
        "exposure": exposure,
        "limit": limit,
        "breach": breach,
        "is_breach": breach > 0
    }

This is better than asking the LLM to perform every business calculation.


26. Logic Apps

Use Logic Apps for enterprise workflow integration.

Agent
 │
 ▼
Logic Apps
 │
 ├── Send email
 ├── Teams notification
 ├── Create approval
 ├── Update CRM
 ├── Create ServiceNow case
 └── Trigger workflow

Example:

Agent detects breach
        │
        ▼
Logic Apps
        │
        ▼
Risk Manager
        │
        ▼
Microsoft Teams
        │
        ▼
Approval

27. Microsoft 365 integration

This is where Azure becomes especially attractive for Microsoft-heavy enterprises.

                    Agent
                      │
          ┌───────────┼────────────┐
          ▼           ▼            ▼
       Outlook      Teams      SharePoint
          │           │            │
          ▼           ▼            ▼
       Email       Approval      Documents

The agent could:

Find policy
      ↓
Investigate breach
      ↓
Create Teams approval
      ↓
Send Outlook notification
      ↓
Update SharePoint case

But permissions must remain delegated and governed rather than allowing the agent unrestricted Microsoft 365 access.


28. Complete agent workflow

User:

“Investigate ABC's exposure breach.”

USER
 │
 ▼
Application Gateway
 │
 ▼
WAF
 │
 ▼
App Service / Container Apps
 │
 ▼
API Management
 │
 ▼
Entra authentication
 │
 ▼
Foundry Agent Service
 │
 ├── get_exposure()
 │       │
 │       ▼
 │    PostgreSQL/API
 │
 ├── get_limit()
 │       │
 │       ▼
 │    PostgreSQL
 │
 ├── get_recent_trades()
 │       │
 │       ▼
 │    Databricks/Fabric/API
 │
 ├── search_policy()
 │       │
 │       ▼
 │    Azure AI Search
 │
 └── calculate_breach()
         │
         ▼
      Azure Function
 │
 ▼
Agent reasoning
 │
 ▼
Recommendation
 │
 ▼
Human approval
 │
 ▼
Logic Apps
 │
 ▼
Teams / Outlook / workflow

29. Example result

The tools return:

Counterparty: ABC

Exposure:
$125M

Approved limit:
$100M

Breach:
$25M

Primary driver:
Trade XYZ

Policy:
Counterparty Policy §4.3

The agent produces:

ABC currently exceeds its approved counterparty
limit by $25M.

The breach is primarily attributable to Trade XYZ.

The applicable policy requires escalation to
Risk Control.

Recommendation:

1. Escalate the breach.
2. Review Trade XYZ.
3. Obtain Risk Control approval before changing
   the exposure limit.

30. Human-in-the-loop

Never allow:

Agent
 ↓
Change credit limit

Instead:

Agent
 ↓
Recommendation
 ↓
Logic Apps
 ↓
Approval
 ↓
Risk Manager
 ┌───────────────┐
 │               │
 ▼               ▼
APPROVE        REJECT
 │               │
 ▼               ▼
Execute        Stop

For regulated financial workloads, this is one of the strongest architecture decisions you can explain in an interview.


31. MCP

For a modern Azure architecture, add MCP.

                         Agent
                           │
                           ▼
                       MCP Client
                           │
          ┌────────────────┼────────────────┐
          ▼                ▼                ▼
      Risk MCP         Trade MCP        Policy MCP
          │                │                │
          ▼                ▼                ▼
      Risk API          Trade API       AI Search

Azure API Management can expose and govern MCP servers, and its AI gateway capabilities also include MCP-related governance. (Microsoft Learn)

This is particularly useful when you have:

Many agents
+
Many tools
+
Many teams

32. Multi-agent architecture

For a more sophisticated financial platform:

                    Supervisor Agent
                           │
          ┌────────────────┼────────────────┐
          ▼                ▼                ▼
     Risk Agent       Compliance Agent    Trade Agent
          │                │                │
          ▼                ▼                ▼
      Risk APIs          Policies         Trade APIs
          │                │                │
          └────────────────┼────────────────┘
                           ▼
                    Decision Agent
                           │
                           ▼
                    Human Approval

But don't use multi-agent just because you can.

A strong interview statement:

“I start with a single agent and deterministic tools. I introduce specialized agents only when responsibility boundaries, security isolation, independent evaluation or organizational ownership justify the additional orchestration complexity.”


33. Agent 365 across the architecture

This is important.

Agent 365 should not be thought of as another model or agent framework.

Think:

                 AGENT 365
              ENTERPRISE CONTROL
                   PLANE
                      │
        ┌─────────────┼──────────────┐
        ▼             ▼              ▼
      FOUNDry       Copilot       3rd Party
       Agents        Agents         Agents
        │             │              │
        └─────────────┼──────────────┘
                      ▼
             Common governance

Microsoft says Agent 365 can also surface agents built on third-party platforms such as Google Vertex AI and Amazon Bedrock in the Microsoft 365 admin center. (Microsoft Learn)

That is a very important enterprise capability.

It means your enterprise architecture can be:

Azure Agent
      +
AWS Agent
      +
GCP Agent
      +
Microsoft 365 Agent
      ↓
Agent 365 governance

34. Evaluation

Your original list:

F1
BLEU
GLEU
METEOR
ROUGE

is useful, but I would modernize the evaluation framework.

For an enterprise RAG/agent platform:

                 EVALUATION
                     │
       ┌─────────────┼─────────────┐
       ▼             ▼             ▼
   Retrieval       Answer        Agent
       │             │             │
       ▼             ▼             ▼
 Precision        Correctness   Tool selection
 Recall           Grounding     Tool arguments
 MRR              Relevance     Trajectory
 NDCG             Citation      Safety

35. Traditional NLP metrics

Use:

BLEU
ROUGE
METEOR
GLEU

when appropriate for text-overlap-oriented tasks.

But for modern GenAI:

BLEU
ROUGE

alone are insufficient.

For RAG:

Context precision
Context recall
Faithfulness
Groundedness
Answer relevance
Citation correctness

For agents:

Tool selection accuracy
Tool argument accuracy
Trajectory correctness
Task completion
Policy compliance
Safety
Latency
Cost

36. Evaluation pipeline

Historical questions
        │
        ▼
Evaluation Dataset
        │
        ▼
Agent
        │
        ▼
┌─────────────────────────┐
│ Evaluation              │
│                         │
│ Retrieval               │
│ Grounding               │
│ Answer                  │
│ Tool usage              │
│ Safety                  │
│ Cost                    │
│ Latency                 │
└────────────┬────────────┘
             │
             ▼
        Scorecard
             │
       ┌─────┴─────┐
       ▼           ▼
    PASS          FAIL
       │           │
       ▼           ▼
 Production      Improve

37. Observability

Use Azure Monitor ecosystem:

Application
    │
    ├── Azure Monitor
    ├── Application Insights
    ├── Log Analytics
    └── Distributed tracing
             │
             ▼
        Observability

Capture:

Request ID
Tenant ID
Agent ID
Model
Prompt tokens
Completion tokens
Latency
Tool calls
RAG retrieval
Search scores
Errors
Retries
Guardrail events
Cost

38. Agent trajectory

Don't log only:

Request → Response

Log:

Request
 │
 ▼
Agent
 │
 ├── RAG
 │    └── AI Search
 │
 ├── Tool
 │    └── Exposure API
 │
 ├── Tool
 │    └── Trade API
 │
 ├── Function
 │
 └── Model
      │
      ▼
   Response

This lets you diagnose:

Why was the answer wrong?

Why was the agent slow?

Why did it call the wrong tool?

Why did it retrieve the wrong document?

Why did cost increase?

39. Scaling

This directly addresses your earlier architecture concern.

Don't autoscale GenAI applications only using CPU.

Monitor:

CPU
Memory
Request rate
Concurrent requests
Queue depth
LLM latency
RAG latency
Token rate
Search latency
Tool latency
Cache hit rate

Architecture:

                 Traffic
                    │
                    ▼
              App Gateway
                    │
                    ▼
               Container
                 Apps
                    │
             ┌──────┴───────┐
             ▼              ▼
          Instance 1      Instance 2
             │              │
             └──────┬───────┘
                    ▼
                APIM
                    │
                    ▼
                  Model

For self-hosted models on AKS:

GPU utilization
GPU memory
batch size
tokens/sec
queue depth
KV cache
concurrency

must also be monitored.


40. Failure handling

Production AI must assume failures.

AI model failure

Primary model
     │
     X
     │
     ▼
Fallback model
     │
     X
     │
     ▼
Graceful degradation

AI Search failure

Agent
 │
 ▼
AI Search
 │
 X
 │
 ▼
Retry
 │
 ▼
Circuit breaker
 │
 ▼
"Knowledge retrieval unavailable"

Enterprise API failure

Agent
 │
 ▼
Risk API
 │
 X
 │
 ▼
Retry
 │
 ▼
Timeout
 │
 ▼
No recommendation

Never hallucinate missing financial data.


41. Private networking

Your proposed architecture is correct in principle, but I would draw it more explicitly:

                       INTERNET
                           │
                           ▼
                  Application Gateway
                           │
                          WAF
                           │
                           ▼
                     Azure VNet
                           │
               ┌───────────┴────────────┐
               │                        │
               ▼                        ▼
        App Service /              Container Apps
        private access
               │                        │
               └───────────┬────────────┘
                           │
                    API Management
                           │
                    Private Endpoint
                           │
          ┌────────────────┼─────────────────┐
          ▼                ▼                 ▼
      AI Search         Cosmos DB         PostgreSQL
          │                │                 │
          └────────────────┼─────────────────┘
                           ▼
                     Azure Services

And outbound traffic:

Private workloads
       │
       ▼
Azure Firewall
       │
       ├── ALLOW approved destination
       │
       └── BLOCK everything else

42. Complete security architecture

                         USER
                           │
                           ▼
                 Application Gateway
                           │
                         WAF
                           │
                           ▼
                     Azure VNet
                           │
                    Azure Firewall
                           │
                           ▼
              App Service / Container Apps
                           │
                           ▼
                 API Management
                           │
                     Entra ID
                           │
                           ▼
                 Foundry Agent Service
                           │
          ┌────────────────┼─────────────────┐
          ▼                ▼                 ▼
       AI Search        Cosmos DB        Enterprise APIs
          │                │                 │
          └────────────────┼─────────────────┘
                           │
                   Private Endpoints
                           │
                  ┌────────┴────────┐
                  ▼                 ▼
               Purview           Defender
                  │                 │
                  └────────┬────────┘
                           ▼
                       Agent 365

43. Complete production architecture

This is the diagram I would memorize.

                              USERS
                                │
                                ▼
                   ┌────────────────────────┐
                   │ Azure Front Door       │
                   │ / Application Gateway  │
                   └───────────┬────────────┘
                               │
                              WAF
                               │
                               ▼
                    ┌───────────────────────┐
                    │ Azure VNet            │
                    │                       │
                    │ App Service           │
                    │ Container Apps        │
                    │ AKS                   │
                    └───────────┬───────────┘
                                │
                                ▼
                 ┌──────────────────────────┐
                 │ Azure API Management     │
                 │ AI Gateway               │
                 │                          │
                 │ Auth                     │
                 │ Token quotas             │
                 │ Rate limits              │
                 │ Model routing            │
                 │ Semantic cache           │
                 │ MCP governance           │
                 │ Cost tracking            │
                 └────────────┬─────────────┘
                              │
                 ┌────────────┼────────────────┐
                 │            │                │
                 ▼            ▼                ▼
           Microsoft       Azure AI         Tool Layer
           Foundry         Search               │
                 │            │                  │
       ┌─────────┼──────┐     │          ┌──────┼──────┐
       │         │      │     │          ▼      ▼      ▼
     Models    Agent  Eval   RAG       Functions Logic APIs
       │       Service       │         Apps
       │         │           │
       ▼         ▼           ▼
    Foundry    Agent      Vector/
    Models     Runtime    Hybrid Search
       │         │           │
       └─────────┼───────────┘
                 │
                 ▼
          Enterprise Data
                 │
      ┌──────────┼─────────────┐
      ▼          ▼             ▼
   Cosmos DB  PostgreSQL    Fabric/Databricks
      │                         │
      └──────────┬──────────────┘
                 ▼
          Business Systems
                 │
                 ▼
          Human Approval
                 │
                 ▼
              USER


     ┌───────────────────────────────────────────┐
     │          ENTERPRISE CONTROL PLANE         │
     │                                           │
     │ Entra ID                                  │
     │ Agent 365                                 │
     │ Defender                                  │
     │ Purview                                   │
     │ Azure Monitor                             │
     │ Application Insights                      │
     │ Azure Firewall                            │
     │ Private Endpoints                         │
     └───────────────────────────────────────────┘

44. Azure mental model

For your interview, remember:

AWS                    GCP                    AZURE

CloudFront             Cloud LB              Front Door
WAF                     Cloud Armor           WAF
ALB                     Cloud LB              App Gateway
ECS/EKS                 Cloud Run/GKE         App Service/
                                             Container Apps/AKS

Bedrock                 Gemini Platform       Microsoft Foundry

Bedrock KB              Vertex/GCP RAG        Azure AI Search
OpenSearch              BigQuery Vector       AI Search
Aurora                  Cloud SQL             PostgreSQL

IAM                     IAM                   Entra ID

KMS                     Cloud KMS             Key Vault

PrivateLink             PSC                   Private Endpoint

CloudWatch              Monitoring            Azure Monitor

X-Ray                   Trace                 App Insights

S3                      Cloud Storage         Blob Storage

SQS/SNS                 Pub/Sub               Service Bus/Event Grid

Redis                   Memorystore           Azure Managed Redis

SageMaker               Vertex AI             Foundry/ML

API Gateway             API Gateway            APIM

Guardrails              Model Armor          AI safety controls

Agent governance        Agent Platform       Agent 365

Azure enterprise ready

Enterprise AI

      │
      ├── Identity
      │     └── Entra
      │
      ├── AI Gateway
      │     └── APIM
      │
      ├── AI Platform
      │     └── Foundry
      │
      ├── Knowledge
      │     └── AI Search / Foundry IQ
      │
      ├── Data
      │     └── Fabric / Databricks / Cosmos /
      │         PostgreSQL
      │
      ├── Agent Governance
      │     └── Agent 365
      │
      ├── Security
      │     └── Defender / WAF / Firewall
      │
      ├── Data Governance
      │     └── Purview
      │
      ├── Networking
      │     └── Private Endpoints
      │
      └── Observability
            └── Azure Monitor

That is the architecture-level answer.

Azure - Financial Services Application with RAG and AgenticAI

I would make the Azure version slightly more advanced than the AWS/GCP versions because Azure now has a particularly strong enterprise story...