6 min readRishi

Securing Secrets in Power Automate: Secure Inputs, Outputs, and Key Vault

Secrets leak in flows because makers put them where the platform is designed to help with debugging: Compose actions, HTTP query strings, variables, and run history. The fix is not hiding the flow from other makers. The fix is to treat secrets as infrastructure, retrieve them just in time, and prevent accidental disclosure in every action that touches them.

Hardcoded secrets are operational debt

If a secret is typed into an action, it will eventually be copied. Someone will duplicate the flow, export the solution, paste a run history screenshot into a ticket, or leave the value in a failed HTTP action. Hardcoded API keys and passwords also make rotation painful because every copy of the flow becomes a place to update.

Use Azure Key Vault as the system of record. Store the secret there, assign access to the identity used by the flow, and let Power Automate retrieve it when needed. For solution-aware apps, use environment variables that reference Key Vault secrets so each environment resolves its own secret without storing the value in the solution.

This is not only about confidentiality. It is also about maintainability. A secret with an owner, expiry policy, and rotation process is easier to operate than a string buried three levels deep inside a cloud flow.

RiskBetter patternWhy it is safer
API key in ComposeKey Vault Get secretValue is managed outside the flow definition
Secret visible in run historySecure Inputs and Secure OutputsAction payload is masked for viewers
Password in environment variable textKey Vault secret referenceSolution carries reference, not value
Secret in HTTP query stringAuthorization headerQuery strings appear in logs more often
Broad vault accessLeast-privilege RBACFlow identity reads only required secrets

Key Vault access should use a controlled identity

Do not connect Key Vault with a random maker account. Use a service principal or managed identity pattern where supported by your tenant and connector strategy. Grant the identity only the permissions it needs, usually read access to specific secrets. With Azure RBAC, assign a narrow role at the vault or secret scope. Avoid broad contributor-style access for automation.

A practical setup has one vault per environment or a clear naming and access boundary inside a shared vault. Development can use non-production secrets. Production should use production secrets protected by stricter access reviews, alerts, and rotation rules.

A minimal configuration record for the flow team might look like this:

{
  "environment": "prod",
  "keyVaultName": "kv-tad-prod",
  "secretName": "payment-api-key",
  "flowIdentity": "spn-powerautomate-prod",
  "requiredPermission": "secrets/get",
  "rotationOwner": "platform-operations"
}

Keep this kind of metadata in deployment documentation or a governed configuration system. Do not place the secret value beside it.

Secure Inputs and Secure Outputs protect run history

Retrieving a secret is only half the job. After the value enters a flow, every downstream action that receives it can expose it in inputs or outputs. Power Automate provides Secure Inputs and Secure Outputs in action settings to mask those values in run history.

Enable Secure Outputs on the Key Vault Get secret action so the secret value is not visible to people inspecting the run. Then enable Secure Inputs on the HTTP action or connector action that consumes the secret. If the response echoes the secret, enable Secure Outputs there as well.

The common chain is:

Key Vault Get secret → Secure Outputs enabled
HTTP action using secret header → Secure Inputs enabled
HTTP response with sensitive data → Secure Outputs enabled when needed

Do not pass secrets through Compose unless there is no reasonable alternative. Compose is often used for troubleshooting, and troubleshooting actions are exactly where sensitive values get left behind.

Secure settings reduce exposure in run history, but they do not turn a poorly scoped secret into a safe design.

Environment variables can reference Key Vault secrets

For ALM, use references instead of values. Environment variables in Power Platform can be configured as secret references backed by Azure Key Vault. That lets the development, test, and production environments point to different vault secrets while the solution remains portable.

In a deployment settings file, the important part is that the target environment receives the correct reference metadata or value source through the approved pipeline. The flow should not need to know whether production uses a different secret name than development. It should read the environment variable and consume the resolved secret.

A simplified deployment setting can be represented like this:

{
  "EnvironmentVariables": [
    {
      "SchemaName": "tad_PartnerApiSecret",
      "Value": "https://kv-tad-prod.vault.azure.net/secrets/partner-api-key"
    }
  ]
}

Treat the URL as sensitive configuration even if it is not the secret itself. It reveals architecture and naming, so keep production settings in your deployment system rather than casually sharing them.

Rotation must be designed before the incident

A secret that cannot rotate is a liability. Prefer APIs and connectors that support overlapping credentials so you can create a new secret, update Key Vault, validate the flow, and then revoke the old secret. If the provider supports versions, decide whether the flow should always read the latest version or a pinned version changed during release.

Latest-version retrieval is operationally convenient, but it can surprise you if a bad secret version is created. Pinned versions are safer for controlled releases but require more deployment discipline. For critical integrations, pair rotation with a smoke-test flow or health check that verifies authentication without processing business transactions.

Also audit where the secret travels. Avoid query strings. Avoid logging request bodies that include credentials. Avoid sending secrets to child flows unless the child flow also uses secure settings and least-privilege ownership.

Secrets deserve production engineering

Power Automate can be enterprise-grade, but only if secrets are treated like production assets. Use Key Vault for storage, controlled identities for access, secure action settings for run history, and environment variable references for ALM. The standard is simple: a maker should be able to support the flow without ever seeing the secret value.

Keep reading

Newsletter

New posts, straight to your inbox

One email per post. No spam, no tracking pixels, unsubscribe anytime.

Comments

No comments yet. Be the first.