Dataverse Config Change to PR for Audit
When an environment variable value changes via the Dataverse admin app, auto-commits the updated value to a config repo and opens a pull request so every env-variable change has a reviewable, merge-able audit trail.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow converts Dataverse environment variable changes into reviewable GitHub activity. Whenever the value column of any environmentvariablevalue row changes — i.e., an admin updates a configuration value in the maker portal or via the admin app — the flow fetches the full context for the change (schema name, display name, variable type, new value, definition/value IDs, modifier) and pushes a repository_dispatch event to a config repository on GitHub. A GitHub Actions workflow on the receiving side can then write the new value to the tracked config file and open a pull request so every env-variable change has a reviewable, merge-able audit trail.
Use Case
Teams that use Dataverse environment variables to hold runtime configuration (API endpoints, feature flags, tenant switches, repo owners/names) often lose the "who changed what, when, and why" audit trail the moment the value leaves their GitOps pipeline. This flow closes that gap without changing how admins edit values. The resulting PR is the audit artifact: reviewers see diff, approver, merge commit SHA, and a linkable URL tied back to the Dataverse change.
The flow is ideal for teams that:
- An admin updates an environment variable value in the usual Dataverse admin UI (Environment Variable Values app, or inline via solution).
- The flow fires on the Update message of environmentvariablevalue with filteringattributes = value, so it only runs when the stored value actually changed (not every metadata touch).
- It enriches the event with the definition row (schema name, type, display name) and dispatches a repository_dispatch event to a GitHub config repo, carrying a structured client_payload that a workflow can turn into a commit + PR.
- The resulting PR is the audit artifact: reviewers see diff, approver, merge commit SHA, and a linkable URL tied back to the Dataverse change.
Flow Architecture
When an Environment Variable Value Is Modified
Dataverse — SubscribeWebhookTrigger (OpenApiConnectionWebhook)Subscribes to Update messages on the environmentvariablevalue entity at Organization scope, running as the modifying user. filteringattributes is set to `value` so the trigger only fires when the stored value actually changes — avoiding noisy re-runs on description edits or internal metadata updates. (entityname: environmentvariablevalue, message: 3 (Update), scope: 4 (Organization), runas: 1 (Modifying user)).
Initialize varConfigRepoOwner
Initialize variableReads the `flowlibs_GitHubConfigRepoOwner` environment variable into a string variable used by the dispatch action.
Initialize varConfigRepoName
Initialize variableReads the `flowlibs_GitHubConfigRepoName` environment variable into a string variable used by the dispatch action.
Initialize varDispatchEventType
Initialize variableReads the `flowlibs_ConfigChangeEventType` environment variable (default dispatch event type, e.g. `dataverse-config-change`) into a string variable used by the dispatch action.
Get Env Variable Value Row
Dataverse — Get a row by ID (GetItem)Loads the full `environmentvariablevalues` row for `@triggerOutputs()?['body/environmentvariablevalueid']` so downstream steps see `value`, `_environmentvariabledefinitionid_value`, `modifiedon`, and `_modifiedby_value`.
Get Env Variable Definition Row
Dataverse — Get a row by ID (GetItem)Loads the parent `environmentvariabledefinitions` row by `@outputs('Get_Env_Variable_Value_Row')?['body/_environmentvariabledefinitionid_value']` to pull `schemaname`, `displayname`, and `type`.
Dispatch Config Change Event To Config Repo
GitHub — Create a repository dispatch event (CreateRepositoryDispatchEvent)Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_GitHubConfigRepoOwner | String | <configure> | Owner (user or org) of the GitHub repo that holds the versioned config. Set during solution import; no flow edits required. |
| flowlibs_GitHubConfigRepoName | String | <configure> | Repo name within that owner. The GitHub Actions workflow that handles repository_dispatch lives here. |
| flowlibs_ConfigChangeEventType | String | dataverse-config-change | The event_type sent on repository_dispatch. GitHub Actions workflows filter on this. Recommended default: dataverse-config-change. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Microsoft Dataverse | shared_commondataserviceforapps | SubscribeWebhookTrigger (trigger — Update on environmentvariablevalue, filteringattributes=value) GetItem (Get Env Variable Value Row) GetItem (Get Env Variable Definition Row) |
| GitHub | shared_github | CreateRepositoryDispatchEvent (Dispatch Config Change Event To Config Repo) |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Point at your own config repo
- In the target environment, set the three environment variable values: flowlibs_GitHubConfigRepoOwner, flowlibs_GitHubConfigRepoName, flowlibs_ConfigChangeEventType. No flow edits are required.
- Add the receiving GitHub Actions workflow
- In your config repo, add a workflow with on: repository_dispatch: types: [<your event type>] that reads github.event.client_payload, writes the new value to the tracked file (e.g., config/env-variables.json), commits on a branch like dataverse/update-<schema_name>-<yyyyMMddHHmmss>, and opens a PR with the payload metadata in the body.
- Narrow which variables audit
- If you only want a subset of variables audited, add a Condition after the Definition lookup that checks schemaname starts with a prefix or is in a list, and route non-matches to a Terminate (Succeeded).
- Filter out empty-string updates
- For variables that admins sometimes blank out intentionally, add an empty(...) check on new_value and skip dispatch so the config repo doesn't get churn commits.
- Switch to signed commits / app-authored PRs
- The built-in GitHub connector commits as the OAuth user. If you need commits authored by a bot identity, replace the final action with a GitHub App token flow (still using CreateRepositoryDispatchEvent) — the downstream workflow in the config repo can use actions/create-github-app-token to author the PR.
- Turn it on
- The flow ships with state = Stopped by design. Start it from the designer or via POST /flows/{id}/start after the environment variable values are set and the receiving workflow is in place.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Trigger binding for the Value row lookup
Used as the row ID input on Get Env Variable Value Row.
EXPR.02Parent definition lookup key
Used as the row ID input on Get Env Variable Definition Row.
EXPR.03Schema name on the dispatch payload
Carried in client_payload.schema_name.
EXPR.04Display name on the dispatch payload
Carried in client_payload.display_name.
EXPR.05Variable type on the dispatch payload
Carried in client_payload.variable_type.
EXPR.06New value on the dispatch payload
Carried in client_payload.new_value.
EXPR.07Modified-by reference on the dispatch payload
Carried in client_payload.modified_by.
EXPR.08Modified-on timestamp on the dispatch payload
Carried in client_payload.modified_on.
EXPR.09Repo owner / name / event type variables
Fed into CreateRepositoryDispatchEvent inputs (repositoryOwner, repositoryName, body/event_type).
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.