Microsoft Azure Fundamentals #3: Maximizing Event-Driven Architecture in Microsoft Power Platform


๐Ÿงฉ 1. Overview

Event-driven architecture (EDA) transforms how systems communicate.
Instead of traditional requestโ€“response or batch integrations, it enables real-time reactions to business changes โ€” making systems more scalable, decoupled, and reactive.

In the Microsoft Power Platform ecosystem, this is best achieved by integrating:

  • Dataverse Change Tracking (source of truth for data changes)
  • Azure Event Grid (event distribution backbone)
  • Azure Functions, Logic Apps, or Service Bus (for processing and orchestration)

โš™๏ธ 2. Core Architecture Flow

๐Ÿ”น Step 1: Enable Change Tracking in Dataverse

  • In the Power Platform Admin Center, enable Change Tracking on the specific tables (entities) you want to monitor.
  • This ensures every create, update, or delete operation is captured with a change token.

๐Ÿ“˜ Example:

<entity name="account" ChangeTrackingEnabled="true" />

Change Tracking maintains incremental changes since the last sync โ€” ideal for event publishing.


๐Ÿ”น Step 2: Create an Azure Event Grid Topic or Domain

  • Go to Azure Portal โ†’ Event Grid โ†’ Create Topic
  • This acts as your event distribution hub.
  • You can later attach multiple subscribers (Functions, Logic Apps, APIs, etc.)

Event Grid provides:

  • Low latency event delivery (<100ms)
  • Retry policies
  • Dead-letter queues for failed events

๐Ÿ”น Step 3: Build a Custom Azure Function to Publish Dataverse Changes

  • Use Dataverse Web API or Service Client SDK to query Change Tracking tokens.
  • Convert these changes into event payloads.
  • Publish events to Azure Event Grid topic using Event Grid SDK.

๐Ÿ“˜ Example (C# Azure Function):

[FunctionName("DataverseChangePublisher")]
public static async Task Run([TimerTrigger("*/2 * * * * *")] TimerInfo myTimer, ILogger log)
{
    var serviceClient = new ServiceClient(Environment.GetEnvironmentVariable("DataverseConnection"));
    var changes = await GetChangedRecords(serviceClient, "account"); // custom function using change tokens

    foreach (var change in changes)
    {
        var eventPayload = new EventGridEvent(
            subject: $"dataverse/{change.EntityName}/{change.Id}",
            eventType: "Dataverse.Entity.Updated",
            data: change,
            dataVersion: "1.0"
        );

        var client = new EventGridPublisherClient(new Uri(Environment.GetEnvironmentVariable("EventGridTopicUri")),
            new AzureKeyCredential(Environment.GetEnvironmentVariable("EventGridKey")));

        await client.SendEventAsync(eventPayload);
    }
}

This function runs periodically (or via webhook) to detect new Dataverse changes and publish them to Event Grid.


๐Ÿ”น Step 4: Subscribe to Events in Azure

Event Grid supports multiple subscribers:

  • Azure Functions โ€“ lightweight code reactions
  • Logic Apps โ€“ workflow-based integrations
  • Service Bus โ€“ reliable queue-based processing
  • Event Hubs โ€“ high-throughput analytics ingestion

๐Ÿ“˜ Example: Azure Function subscriber

[FunctionName("DataverseEventSubscriber")]
public static void Run([EventGridTrigger] EventGridEvent eventGridEvent, ILogger log)
{
    var data = eventGridEvent.Data.ToObjectFromJson<DataverseEntityChange>();
    log.LogInformation($"Received Dataverse change for {data.EntityName} with ID: {data.Id}");
    
    // Further logic: update Azure SQL, call external API, etc.
}


๐Ÿ”น Step 5: Implement Retry & Dead-Letter Handling

  • Configure Event Gridโ€™s dead-letter destination (Storage Account or Service Bus).
  • Implement retry logic in Functions for transient errors.
  • Use Application Insights for telemetry and observability.

๐Ÿ”น Step 6: Bi-Directional Flow (Optional)

If changes must flow back from Azure SQL or external systems into Dataverse:

  • Reverse the flow by triggering events on Azure side.
  • Use Power Automate or Azure Functions to call Dataverse Web API and apply changes.
  • Use custom correlation IDs to avoid circular updates.

๐Ÿง  3. Design Considerations

CategoryRecommendation
ScalabilityUse Event Grid domains for multiple publishers.
SecurityUse Azure Managed Identity for Dataverse and Event Grid access.
LatencyEvent delivery <100ms; ensure Functions are cold-start optimized.
Data IntegrityImplement idempotent processing (ignore duplicates).
MonitoringCentralize logs with Application Insights.
GovernanceUse consistent naming conventions for topics, events, and subscribers.

๐Ÿ“ˆ 4. Example Use Cases

โœ… Sync Dataverse records in near real-time to Azure Data Lake or SQL.
โœ… Trigger external workflows (e.g., Teams alerts, ERP updates) on Dataverse events.
โœ… Power analytics pipelines that respond to business data instantly.
โœ… Enable microservice integrations where each service reacts to Dataverse changes.


๐Ÿงฉ 5. Benefits

  • Reactive Systems โ€” Respond instantly to business changes.
  • Decoupled Architecture โ€” Producers and consumers evolve independently.
  • High Reliability โ€” Built-in retries and dead-lettering.
  • Cloud-Native Scalability โ€” Event Grid auto-scales with volume.
  • Auditability โ€” Full event trace via Application Insights.

๐Ÿ” 6. Extended Enhancements

  • Add Event Schema Registry for structured event payloads.
  • Use Azure API Management to expose event metadata.
  • Introduce Event Correlation IDs for distributed tracing.
  • Combine with Dataverse Plug-ins to trigger events directly at transaction time.

โœ… Final Architecture Summary

Flow:
Dataverse (Change Tracking) โ†’ Azure Function (Publisher) โ†’ Event Grid โ†’ Azure Function / Logic App (Subscriber) โ†’ Target System

Key Patterns:

  • Publisherโ€“Subscriber decoupling
  • Event-based orchestration
  • Scalable, fault-tolerant integration


Discover more from Common Man Tips for Power Platform, Dynamics CRM,Azure

Subscribe to get the latest posts sent to your email.

Leave a comment