Trial Environment Expiry Warning
Scheduled flow lists trial environments from Power Platform for Admins, computes days remaining, and sends Outlook warnings to environment owners at 7 days and again on expiry day.
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
FlowLibs - Trial Environment Expiry Warning is a scheduled Cloud Flow that monitors trial Dataverse environments approaching expiration. It queries an environment inventory table daily, identifies trials within a configurable warning window, and sends a professionally formatted HTML email alert to administrators with environment details, days remaining, and recommended actions.
Use Case
IT Admins managing Power Platform tenants need proactive visibility into trial environment lifecycles. Trial environments are automatically deleted by Microsoft after expiration, potentially causing data loss for makers who haven't backed up their work.
The flow is ideal for teams that:
- Early warning at a configurable number of days before expiry (default: 7 days)
- Expired environment alerts for trials past their expiration date
- Actionable guidance — extend, convert to production, or backup and decommission
- Zero-touch daily monitoring via scheduled recurrence
Flow Architecture
Recurrence Daily 8am EST
RecurrenceFires once per day at 12:00 UTC (8:00 AM Eastern).
Init varAdminEmail
Initialize Variable (String)Binds to flowlibs_AdminNotificationEmail env var.
Init varEnvironmentTable
Initialize Variable (String)Binds to flowlibs_TrialEnvironmentTable env var.
Init varWarningDays
Initialize Variable (Integer)Binds to flowlibs_TrialExpiryWarningDays env var, cast to int.
Init varExpiryAlertHtml
Initialize Variable (String)Empty string accumulator for HTML table rows.
Init varExpiringEnvCount
Initialize Variable (Integer)Counter for expiring environments, starts at 0.
List Trial Environment Records
Dataverse ListRecordsQueries the environment table filtered for Trial type.
For Each Trial Environment
Foreach loopIterates over each trial environment record. For each item: computes days until expiry via tick arithmetic, then checks if the value is within the configured warning window. When inside the window (or already past expiry), appends an HTML table row (env name, type, owner, expiry date, color-coded days remaining) to varExpiryAlertHtml and increments varExpiringEnvCount.
Check If Any Environments Expiring
If conditionTests if varExpiringEnvCount > 0.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_AdminNotificationEmail | String | <configure> | Recipient email for expiry warnings. Set to your admin team's email address. |
| flowlibs_TrialExpiryWarningDays | String | 7 | Number of days before expiry to trigger alerts. Cast to integer at runtime. |
| flowlibs_TrialEnvironmentTable | String | admin_environment | Dataverse table containing the environment inventory used to look up trial environments. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Microsoft Dataverse | shared_commondataserviceforapps | ListRecords (Query environment inventory table) |
| Office 365 Outlook | shared_office365 | SendEmailV2 (Send expiry warning emails) |
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.
- Deploy in a new environment
- Import the solution into the target environment, set the three environment variable current values (flowlibs_AdminNotificationEmail, flowlibs_TrialExpiryWarningDays, flowlibs_TrialEnvironmentTable), authorize both connections (Dataverse + Outlook) with a service account, then turn on the flow.
- Customize the warning window
- Update the flowlibs_TrialExpiryWarningDays environment variable. The flow casts this value to an integer at runtime, so any whole-number string works (e.g. 3, 7, 14).
- Change the email format
- Edit the Compose Expiry Warning Email action. The email uses inline CSS with a gradient header, stat badge, HTML table, and recommendations section — tweak the HTML/CSS string to rebrand or restructure.
- Add additional notification channels
- Add a Teams PostMessageToConversation action (or any other channel) after the email action inside the True branch of Check If Any Environments Expiring.
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.01Days until expiry calculation
Converts the difference between expiration date and now from ticks to days. Uses coalesce to handle null expiration dates gracefully.
EXPR.02Color-coded days remaining
Red for expired (<= 0 days), orange for approaching expiry.
EXPR.03Dynamic email subject
Builds the email subject line with the count of expiring environments and today's date.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.