
๐งฉ 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
| Category | Recommendation |
|---|---|
| Scalability | Use Event Grid domains for multiple publishers. |
| Security | Use Azure Managed Identity for Dataverse and Event Grid access. |
| Latency | Event delivery <100ms; ensure Functions are cold-start optimized. |
| Data Integrity | Implement idempotent processing (ignore duplicates). |
| Monitoring | Centralize logs with Application Insights. |
| Governance | Use 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.
