Skip to content

[BUG] Client Secret with secret type environment variable does not keep reference when importing solution #4010

@aagirre92

Description

@aagirre92

Type of Connector

Custom Connector

Name of Connector

(not relevant)

Describe the bug

Title

Custom connector OAuth2 client secret via environment variable is not retained on managed solution import


Description

When using a custom connector in a Power Platform solution with OAuth2 (authorization code flow), and configuring the Client Secret property via a secret-typed environment variable, the following behaviour occurs:

  • In Dev environment, the custom connector’s Client Secret is set to @environmentVariables("MySecretEnvVar").
  • The secret-typed environment variable is part of the same solution.
  • The solution is exported as managed.
  • When imported into a target environment (e.g. Prod), the custom connector’s Client Secret does not retain the reference to the environment variable (i.e. the field is blank or static, with no link to the env var).
  • Only after manually editing the custom connector in Prod (setting the Client Secret again to @environmentVariables("MySecretEnvVar")) and saving does the connector correctly pick up the secret via the environment variable.

This requires a manual fix step in the target environment, which undermines automation/ALM/CI-CD practices and can lead to misconfiguration or drift.


Is this a security bug?

Yes, this is a security bug

What is the severity of this bug?

Severity 1 - Connector is broken or there's a very serious issue

To Reproduce

Steps to Reproduce

  1. In Dev environment, create a solution.
  2. Add a secret‐typed environment variable named (for example) MySecretEnvVar.
  3. Create or edit a custom connector (in the same solution) that uses OAuth2 Auth Code flow.
  4. In the custom connector’s Security tab, set the Client Secret value to: @environmentVariables("MySecretEnvVar"))and then save.
  5. Export the solution as managed.
  6. Import into the target environment (e.g. Prod). and fill in the env variables with the prod. values (import is correctly done)
  7. Inspect the custom connector → you’ll see the Client Secret is not referencing the environment variable (blank or static).
  8. Manually open the connector in Prod, enter @environmentVariables("MySecretEnvVar") in Client Secret, save → connector then works.

Expected behavior

I would expect that this is done automatically! Having to point the client secret to the env variable again when importing the solution is not optimal

Environment summary

  • Unmanaged solution created and tested in a dev type environment (Europe region)
  • Managed solution imported to a managed environment type (Europe region)

Additional context

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions