Environment Naming Convention Auditor
Scheduled flow lists all environments from Dataverse inventory and validates names against a regex pattern stored in an admin config table (e.g., BU-Purpose-Stage). Non-compliant environments are flagged in a weekly Outlook report to admins with suggested corrections.
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
A scheduled governance flow that audits Dataverse environment inventory records against a configurable naming convention (BU-Purpose-Stage format). Non-compliant environments are compiled into a professional HTML report and emailed to administrators weekly. Designed for COE teams enforcing consistent environment naming across tenants.
Use Case
Organizations with multiple Power Platform environments often lack naming consistency, making it difficult to identify environment purpose, owning business unit, or lifecycle stage at a glance. This flow automates the audit process — replacing manual spreadsheet reviews with a weekly automated compliance check that flags violations before they proliferate.
Flow Architecture
Weekly Audit Schedule
RecurrenceFires every Monday at 8:00 AM EST to kick off the weekly environment naming audit.
Init varRecipientEmail
Initialize variableReads the flowlibs_AuditReportRecipient env var into a variable for the report recipient.
Init varEnvironmentTable
Initialize variableReads the flowlibs_EnvInventoryTableName env var for the Dataverse table to query.
Init varNonCompliantHtml
Initialize variableString accumulator for building HTML table rows of violations.
Init varNonCompliantCount
Initialize variableInteger counter tracking total violations found during the audit.
List Environment Inventory
Dataverse — List rowsQueries all records from the configured environment inventory table (e.g., CoE Starter Kit admin_environment).
Check Each Environment
Apply to eachFor each environment record returned by the list action, evaluates compliance and accumulates violation rows.
If Check If Name Is Non Compliant
If conditionInside the Apply to each. Evaluates two criteria using split(), length(), last(), contains(), and createArray(): does the name have exactly 3 hyphen-separated segments, and is the last segment a valid stage (Dev, UAT, Prod, Sandbox)?
- Increment Non Compliant Count — Adds 1 to varNonCompliantCount.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_EnvNamingPattern | String | ^[A-Z]{2,4}-[A-Za-z]+-(?:Dev|UAT|Prod|Sandbox)$ | Regex pattern (or simple shape) describing the required environment naming convention. Defaults to BU-Purpose-Stage where Stage is one of Dev, UAT, Prod, or Sandbox. |
| flowlibs_AuditReportRecipient | String | admin@your-tenant.onmicrosoft.com | Email address that receives the weekly audit report. Set to your admin team's mailbox or distribution list. |
| flowlibs_EnvInventoryTableName | String | admin_environment | Dataverse table logical name containing the environment inventory (e.g., CoE Starter Kit admin_environment table, or a custom table). |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Microsoft Dataverse | shared_commondataserviceforapps | ListRecords (Reading environment inventory records) |
| Office 365 Outlook | shared_office365 | SendEmailV2 (Sending the audit report email) |
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.
- Import and configure environment variables
- Import the solution (or recreate via API payloads in the Build Reference). Set flowlibs_AuditReportRecipient to your admin team's email or DL, flowlibs_EnvInventoryTableName to your environment inventory table (e.g., admin_environment from CoE Starter Kit), and update flowlibs_EnvNamingPattern to reflect your organization's naming standard.
- Authorize connections
- Authorize both Dataverse and Office 365 Outlook connections with a service account or admin account that has read access to the environment inventory table and send-as permissions for the report sender mailbox.
- Adapt the compliance condition
- Modify the condition expression inside 'Check If Name Is Non Compliant' if your naming convention differs from BU-Purpose-Stage (e.g., different segment count, different stage values, or a different separator character).
- Tune the schedule
- Adjust the Recurrence trigger if weekly Monday 8 AM EST doesn't fit your operational cadence. Daily or bi-weekly recurrences work equally well.
- Add Teams notifications
- Add a Teams notification alongside the email by inserting a PostMessageToConversation action in the True branch of 'Check If Violations Found' so violations are visible in a governance channel.
- Log violations to Dataverse
- Track violations over time by adding a Dataverse CreateRecord action inside the non-compliant branch to log each non-compliant environment name with a timestamp for trend reporting.
- Validate business unit codes
- Add BU code validation by maintaining a lookup table of valid business unit codes and cross-referencing the first segment of each environment name against that list.
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.01Name segment parsing
Splits the environment name into an array of segments using hyphen as the delimiter.
EXPR.02Compliance check — 3-segment validation
Verifies the name has exactly 3 hyphen-separated parts.
EXPR.03Stage validation
Checks if the final segment is a recognized lifecycle stage.
EXPR.04HTML row accumulation
Builds one HTML <tr> per violation; the Compose action later wraps all rows in a styled <table> with headers.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.