Skip to main content

Notifications

Community site session details

Community site session details

Session Id : MGOESCbwMvHMCP3dV9hbaa
Power Automate - Connector Development
Unanswered

Custom Connectors - Environment Variables for API Token/Key

Like (1) ShareShare
ReportReport
Posted on 14 Mar 2025 13:18:50 by 402
Hi everyone,
 
I am currently looking at building a Custom Connector. I want it to be 'solutionised' so am designing it to avoid having hard coded values in the Custom Connector itself, instead offloading these to Environment Variables.
 
I have successfully added an Environment Variable for the Host parameter in the General Information section. This shows up and works fine in Section 3: Definition, in the 'Request' section.
 
For the API I'm using, it is a requirement that the API Token is provided in the Header of the request to the Endpoint, as shown in the below screenshot:
 
 
When the 'X-API-Token' Header property is 'Edited', it shows up like this:
 
 
When the Custom Connector is added to the Flow, in Edit mode, the requirement for the X-API-Token shows as designed, in the Action, as below. However, this requires the user to provide their API Token in plain text, which is then stored within the Flow. If the Flow was shared with other users, etc, this would be problematic, and I'm aware it's not best practice to store 'Secrets' in plain text anyway.
 
 
I'm therefore wondering what the best practice is to request and securely manage the user's API Token.
 
Does anyone know if an Environment Variable can be used in the 'Headers' section of a 'Request' part of a '3. Definitions' configuration of a Custom Connector? In classic Microsoft-style, the documentation for this is very unhelpful, as it says: "
Currently, environment variables aren't supported in actions, triggers, or policies." Well, the Environment Variable that already works successfully for me is showing in the Request section of the Action in the Definition section, so theoretically that is an Environment Variable within an Action.
 
If an Environment Variable can be used in the 'Headers' section of a 'Request' part of a '3. Definitions' configuration, my thinking was to use the 'Secret' Environment Variable type, and leverage Azure Key Vault to store the API Token. This would then not present the requirement to the user to add their API Token in the action in the Flow. I imagine this would work by setting the Default Value to the Environment Variable, and then the Visibility to 'internal' as the user does not need to manipulate anything.
 
I've not used Azure Key vault before, so before spending a lot of time on this, can anyone confirm if this would work, and is best practice, or if not, any other secure alternatives to this?
 
Thank you very much!
 
Categories:
  • pp365 Profile Picture
    402 on 17 Mar 2025 at 18:08:28
    Custom Connectors - Environment Variables for API Token/Key
    Just to provide a quick update in case helpful to any readers, but it would still be very beneficial if anyone has experience/knowledge on this topic if it could be shared.
     
    In the meantime I am moving forward with investigating the feasibilities of using Azure Key Vault; this seems like it will be very beneficial regardless of whether the optimum outcome can be achieved and the 'Secret' is manged by an Environment Variable or not.
     
    Any inputs in to this query would be gratefully received - thank you!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard

Featured topics

Loading started