ECG_Dataverse_Flows 0.2.0
ECG_Dataverse_Flows
Read-only client for Power Automate cloud flows and their run history in Dataverse. Built for batch jobs that archive runs, because Dataverse keeps them for 28 days only.
Usage
using var http = new HttpClient();
var client = new DataverseFlowClient(
http,
orgUrl: "https://orgXXXXXXX.crm4.dynamics.com",
tenantId: tenantId,
clientId: clientId,
clientSecret: clientSecret);
var flows = await client.GetFlowsAsync();
var runs = await client.GetRunsAsync(since: DateTime.UtcNow.AddDays(-2));
The client does not own the HttpClient, so lifetime and timeout stay your decision.
Power BI reads (0.2.0)
| Method | Table | Notes |
|---|---|---|
GetFlowsAsync(definitionsAt) |
workflows, cloud |
Trigger kind, connectors and action count from clientdata |
GetDesktopFlowsAsync(definitionsAt) |
workflows, desktop |
Action count from definition |
GetDesktopRunsAsync(modifiedSince) or (ids) |
flowsessions |
rundetails is reduced to step times, action count and machine facts |
GetMachinesAsync, GetMachineGroupsAsync |
flowmachines, flowmachinegroups |
Snapshot |
GetWorkQueuesAsync |
workqueues |
Snapshot |
GetWorkQueueItemsAsync(modifiedSince) or (ids) |
workqueueitems |
Without the item content |
GetFlowEventsAsync(createdSince) |
flowevents |
Gaps in the run history |
definitionsAt maps each flow whose definition you already hold to the ModifiedOn it was read at.
A definition is read only for the other flows, so a nightly run does not download them all.
Flow.Definition is null for a flow that was not read. Only the extracted facts are returned, never the definition.
Never read, and absent from every select: sessionusername, sessionusersid, run inputs and outputs, and the
work queue item name, input, processingresult, executioncontext and uniqueidbyqueue. Selects and
NeverRead list what is requested, so a test can check it.
The app registration needs read access to the extra tables for these calls: Flow Session, Flow Machine,
Flow Machine Group, Work Queue, Work Queue Item and Flow Event.
Always fetch a wider window than the last run reached and upsert on FlowRun.RunId. Rows are
written a couple of minutes after a run starts, so an exact watermark loses data.
Runs come back as raw rows rather than counts. Aggregate them in SQL, where you can re-slice by week, by error, or with child runs excluded, without re-fetching anything.
Requirements
The app registration must also exist as an Application User in the Power Platform admin
centre with read access to Process and Flow Run. Without it the token is issued fine and the
req returns 401.
Only solution aware flows produce flowrun rows. Flows living outside a solution report no runs
at all, even when they run.
Flows shipped by managed Microsoft solutions are left out of GetFlowsAsync. In the first
environment we tested, one Project Operations housekeeping flow ran hourly and accounted for 672
of 675 rows.
No packages depend on ECG_Dataverse_Flows.
.NET 10.0
- No dependencies.