Applies to Product- Power Automate
What’s happening?
While using the Azure Key Vault Connector in a Power Automate flow, customers are experiencing issues when adding special characters into Azure Key Vault secrets, resulting in extra backslashes () and quotes ("") being included in the stored values.
Reason:
The underlying cause of this is related to how special characters are processed and stored in Azure Key Vault, leading to incorrect formatting of secrets.
Resolution:
To resolve this of extra backslashes and quotes in Azure Key Vault secrets, follow these steps:
- Use String Manipulation Functions:
- Utilize functions like replace() or trim() to clean the secret value before storing it in Key Vault.
- Handle Encoding/Decoding:
- Consider using the uriComponent() function in Power Automate to encode the string before storing it and decode it when retrieving it.
- Example: When storing the secret, encode the value as a URI component using uriComponent('yourSecretValue').
- Test the Retrieved Value:
- Use a Compose action to output the secret value immediately after retrieval to confirm if the extra backslashes are present due to how Power Automate handles the string.
- Fix the Secret Format:
- Ensure that the secret being stored in Key Vault does not contain unintended escape characters or quotes. Manually adjust the secret in Azure Key Vault if necessary.
- Create a Test Flow:
- If unsure about the behavior, create a simple test flow to retrieve a secret from Azure Key Vault and output it directly using the Compose action to isolate the issue.
- Example Flow Structure:
- Action 1: Get Secret from Azure Key Vault.
- Action 2: Output the secret using the Compose action.
- Action 3: Clean the secret if necessary using replace() or trim() functions.
https://learn.microsoft.com/en-us/connectors/keyvault/#get-secret
