Domain 5 β€” Module 9 of 9 100%
23 of 26 overall
Domain 5: Extend the Platform Free ⏱ ~13 min read

Cloud Flows: Security, Errors & Child Flows

Harden your cloud flows for production. Learn to secure sensitive data, handle errors with try/catch patterns, build reusable child flows, and use Azure Key Vault and service principals.

Production-grade flows

Simple explanation

Think of hardening a flow like childproofing a house.

A flow that works in testing is like a house with no safety features. To make it production-ready, you need: locks on cabinets (secure sensitive data), smoke alarms (error handling β€” know when things go wrong), instruction manuals (child flows β€” reusable steps anyone can follow), and spare keys with trusted neighbours (service principals β€” flows that work even when the builder leaves).

Securing sensitive data

Secure inputs and outputs

By default, flow run history shows every input and output value. For sensitive data (passwords, tokens, personal info), this is a security risk.

Secure Inputs: Hides the action’s input values in run history. Secure Outputs: Hides the action’s output values in run history.

Enable them in the action’s Settings tab. When enabled, run history shows β€œContent not shown due to security configuration” instead of the actual values.

Azure Key Vault integration

For secrets that flows need (API keys, connection strings, certificates), use Azure Key Vault instead of hardcoding values.

Pattern:

  1. Store the secret in Azure Key Vault
  2. Add the β€œAzure Key Vault” connector to your flow
  3. Use the β€œGet secret” action to retrieve the value at runtime
  4. Enable Secure Outputs on the Get secret action (so the value does not appear in run history)
Use Key Vault for secrets, environment variables for config, never hardcode
MethodHardcoded in FlowEnvironment VariableAzure Key Vault
SecurityVisible in flow definitionVisible in admin centreEncrypted, access-controlled
RotationEdit every flow that uses itUpdate the variable valueUpdate in Key Vault β€” flows get new value automatically
Audit trailNoNoYes β€” Key Vault logs every access
Best forNever β€” do not hardcode secretsNon-sensitive config (URLs, emails)Secrets (API keys, passwords, tokens)

Error handling patterns

The Scope pattern (try/catch/finally)

Power Automate does not have native try/catch, but you can build it with Scopes:

Scope: Try
  β”œβ”€β”€ Action 1 (call API)
  β”œβ”€β”€ Action 2 (process result)
  └── Action 3 (update Dataverse)

Scope: Catch (Configure Run After = "has failed", "has timed out")
  β”œβ”€β”€ Log error to Dataverse
  └── Send alert email

Scope: Finally (Configure Run After = "is successful", "has failed", "has timed out", "is skipped")
  └── Clean up temporary data

Configure Run After is the key: by default, each action runs only after the previous one succeeds. To create a β€œcatch” block, configure the Catch scope to run after the Try scope has failed or timed out.

Error handling best practices

  • Always wrap critical logic in a Try scope β€” unhandled errors leave flows in a β€œFailed” state with no recovery
  • Log errors to a Dataverse table β€” not just email notifications (emails get lost)
  • Include context in error logs β€” which record, which step, what error message
  • Use the result() function to get error details: result('Try_Scope')[0]?['error']?['message']

Child flows

Child flows are reusable flows called by parent flows. They accept inputs and return outputs.

When to use child flows

  • Same logic in multiple flows β€” β€œSend formatted notification” used by 5 parent flows
  • Complex flows that are hard to read β€” break into logical child flows for clarity
  • Different teams own different parts β€” one team owns the child flow, parent flows just call it

Creating a child flow

Important: Child flows must be created inside a solution. Both parent and child flows should be in the same solution for the β€œRun a Child Flow” action to work.

  1. Open your solution in make.powerautomate.com β†’ Solutions
  2. Create a new cloud flow with the β€œManually trigger a flow” trigger
  3. Define input parameters (text, number, yes/no, file, email)
  4. Build the logic
  5. End with a β€œRespond to a PowerApp or flow” action to return outputs
  6. In the parent flow (also in the solution), use β€œRun a Child Flow” action
Scenario: Elena builds reusable error handling

Elena creates a child flow called β€œLog Integration Error” that:

Inputs: ErrorSource (text), ErrorMessage (text), RecordId (text), Severity (text) Logic:

  1. Creates a record in the Integration_Log table with all input details + timestamp
  2. If Severity = β€œCritical”, sends a Teams message to the IT Ops channel
  3. If Severity = β€œCritical” and it is outside business hours, sends an SMS via the Twilio connector

Now every parent flow in the organisation calls this child flow in its Catch scope. One place to maintain error handling logic, consistent logging, and automatic escalation.

Service principals for flows

A service principal is an application identity (not tied to a person) used for flow connections.

Why service principals matter

  • User leaves β†’ Flows using their connection break. Service principal connections persist.
  • Licence changes β†’ User loses Power Automate licence β†’ their flows stop. Service principal is independent.
  • Security audit β†’ Service principal permissions are clearly defined and auditable.

Setting up a service principal connection

  1. Register an application in Microsoft Entra ID
  2. Create a client secret or certificate
  3. Create an application user in Dataverse with appropriate security roles
  4. In Power Automate, create a connection using the service principal credentials
  5. Map connection references to this connection in your solutions
Question

What does 'Secure Inputs' do on a flow action?

Click or press Enter to reveal answer

Answer

It hides the action's input values from the flow run history. Instead of seeing the actual data (which might include passwords, tokens, or personal information), run history shows 'Content not shown due to security configuration.' Enable it on any action that handles sensitive data.

Click to flip back

Question

How do you implement try/catch in Power Automate?

Click or press Enter to reveal answer

Answer

Use the Scope action pattern: put risky actions inside a 'Try' Scope. Add a 'Catch' Scope configured to Run After the Try scope 'has failed' or 'has timed out'. Add a 'Finally' Scope configured to run after all outcomes. Use result() to get error details from the failed scope.

Click to flip back

Question

Why should production flows use service principal connections instead of user connections?

Click or press Enter to reveal answer

Answer

Service principals are not tied to a person. They persist when employees leave, are not affected by licence changes, and have clearly defined, auditable permissions. User connections break when the user leaves or loses their licence.

Click to flip back

Knowledge Check

A flow retrieves an API key from Azure Key Vault and uses it to call an external service. After running, the API key is visible in the flow run history. What should the developer do?

Next up: Publishing Dataverse Events β€” sending events to external systems with webhooks, Service Bus, and Event Hub.