← Back to Dashboard

Design 7: Serverless Function (Event Grid + Logic App)

Summary

This design implements Azure Functions and Event Grid.

Topology: The Function App runs in a Spoke VNet (Premium Plan for VNet Integration).

1. Key Design Decisions (ADR)

ADR-01: Compute

  • Decision: Azure Functions (Premium).
  • Rationale: Required for VNet Integration (to reach Hub) and pre-warmed instances (no cold start).

ADR-02: Eventing

  • Decision: Event Grid.
  • Rationale: Push-based eventing.

2. High-Level Design (HLD)

+--------------+           +--------------------------+           +--------------+
|  Event       |           |        HUB VNet          |           |  SPOKE VNet  |
|  Source      |           |      (Firewall)          |           |  (Function)  |
+------+-------+           +------------+-------------+           +------+-------+
       |                                |                                |
       v                                | (Peering)                      |
+------+-------+                        v                                v
|  Event Grid  |           +------------+-------------+           +------+-------+
|  Topic       |---------->| Azure Firewall           |<--------->|  Function    |
+--------------+           | (Egress)                 |           |  App         |
                           +--------------------------+           +------+-------+

3. Low-Level Design (LLD)

                               PRIMARY REGION (East US)
+-----------------------------------------------------------------------+
| HUB VNet: vnet-hub (10.0.0.0/16)                                      |
|   +-----------------------+                                           |
|   | Azure Firewall        |                                           |
|   +-----------|-----------+                                           |
|               |                                                       |
|               v (Peering)                                             |
+---------------|-------------------------------------------------------+
                |
+---------------|-------------------------------------------------------+
| SPOKE VNet: vnet-func-spoke (10.1.0.0/16)                             |
|   +-----------------------+                                           |
|   | Subnet: Integration   |                                           |
|   | [Function App]        |                                           |
|   +-----------------------+                                           |
+-----------------------------------------------------------------------+

                               SECONDARY REGION (West US)
+-----------------------------------------------------------------------+
| DR STRATEGY                                                           |
|   +-----------------------+                                           |
|   | Function App (DR)     |                                           |
|   | (Stopped)             |                                           |
|   +-----------------------+                                           |
+-----------------------------------------------------------------------+

4. Component Rationale

  • Premium Plan: Allows VNet Integration.

5. Strategy: High Availability (HA)

  • SLA: 99.95%.

6. Strategy: Disaster Recovery (DR)

  • Implementation: Active-Passive.
  • Process: Deploy Function code to West US.

7. Strategy: Backup

  • Code: Git.
  • Config: App Settings.

8. Strategy: Security

  • Network: VNet Integration.

9. Well-Architected Framework Analysis

  • Reliability: High.
  • Security: High.
  • Cost Optimization: Medium. Premium plan costs ~$150/mo.
  • Operational Excellence: High.
  • Performance Efficiency: High.

10. Detailed Traffic Flow

1. Event: Blob uploaded.

2. Grid: Event Grid fires event.

3. Trigger: Function triggers.

4. Process: Function processes data.

5. Outbound: Function writes to SQL via VNet Integration.

11. Runbook: Deployment Guide (Azure Portal)

11. Runbook: Deployment Guide (Azure Portal)

Phase 1: Create Resource Group & VNet

1. Create Resource Group: rg-design07-func. Region: East US.

2. Create VNet:

* Name: vnet-func-spoke.

* Address space: 10.1.0.0/16.

* Subnet: snet-func-int (10.1.1.0/24).

* *Note: This subnet will be delegated.*

3. Peering: Peer vnet-func-spoke to vnet-hub.

Phase 2: Create Function App (Premium)

1. Search: "Function App" -> + Create.

2. Resource Group: rg-design07-func.

3. Name: func-corp-events-[uniqueid].

4. Runtime stack: .NET 6 (or your choice).

5. Region: East US.

6. Hosting:

* Plan type: Functions Premium.

* Plan: Create new plan-func-prem.

7. Storage: Create new stfuncstorage.

8. Networking:

* Enable public access: On (for trigger convenience) or Off (for strict security).

* Enable network injection: On.

* Virtual Network: vnet-func-spoke.

* Subnet: snet-func-int.

9. Create.

Phase 3: Create Event Grid Topic

1. Search: "Event Grid Topics" -> + Create.

2. Resource Group: rg-design07-func.

3. Name: egt-corp-main.

4. Region: East US.

5. Create.

Phase 4: Create Function Trigger

1. Go to Function App -> Functions -> + Create.

2. Template: Azure Event Grid trigger.

3. Name: ProcessEvent.

4. Create.

5. Integration:

* Click Event Grid Trigger (Input).

* Create Event Subscription.

* Name: sub-func-process.

* Topic Type: Event Grid Topic.

* Source Resource: egt-corp-main.

* Create.

Phase 5: Verify

1. Go to the Event Grid Topic.

2. Overview -> Copy Topic Endpoint.

3. Use Postman or Curl to send a test event to the Topic Endpoint (requires Access Key).

4. Check Function App Monitor logs to see the event processed.