Skip to content

Error Retrieving Key Vault Secret

Error message (sample)

The following is a secret-name redacted example for the typical error message thrown when a key-vault secret cannot be retreived by the PF portal.

{
    "message": "KeyVault secret '<redacted--secret--name>' could not be retrieved for connection string type 'TargetCrm'. The secret may have been deleted or is temporarily unavailable.",
    "errors": [],
    "warnings": [
        "No validation exists for record: ProcessFactorial.Model.Customer.ScaleGroupLink"
    ]
}

Symptoms

  • The Output Log window in PF portal displays the afore-mentioned error message.
  • The Config Function App logs show a failure to retrieve a Key Vault secret.
  • Connection string resolution fails for a specific CRM target.
  • Related functionality that depends on the missing connection string stops working. For the PF portal, bulk of the api calls are orchestrated from the config function app.
  • The warning about ScaleGroupLink validation may appear alongside the error but is not the root cause.

Scope

Occurs on both SaaS Model and Customer Hosted Model installations where the Config Function App is configured to retrieve secrets from Azure Key Vault.

Known instances

Config Function App unable to read Key Vault secret

When the Config Function App attempts to resolve a connection string (e.g., TargetCrm), it fails to retrieve the corresponding secret from Azure Key Vault. The secret name in the error includes the environment and connection string identifiers.

Root cause

There are two potential root causes:

  1. Key Vault firewall blocking access — The Azure Key Vault has been secured with a firewall that restricts traffic to specific IP address ranges. If the Config Function App's outbound IPs are not whitelisted, the function app cannot read the secret. This typically occurs when the firewall is set to allow traffic only from specific IP ranges rather than allowing public access.

  2. Missing secret — The required secret does not exist in the Key Vault. It may have been deleted accidentally or never created during the deployment or configuration process.

Resolution

Cause 1: Key Vault firewall blocking access

Choose one of the following solutions:

Option A — Allow public access (less restrictive): Configure the Key Vault firewall to allow public access from all networks. This is the simplest approach but provides less network-level security.

Option B — Whitelist outbound IPs (more restrictive): Whitelist all of the outbound IP addresses of the Config Function App (and any other applications that might need Key Vault access) in the Key Vault firewall settings. This ensures only authorised services can retrieve secrets.

# Example: Retrieve outbound IPs for a Function App
# (Run in Azure CLI or Cloud Shell)
az functionapp show --resource-group <your-resource-group> --name <your-function-app-name> --query possibleOutboundIpAddresses

Add the returned IP addresses to the Key Vault firewall allowlist under Networking → Firewalls and virtual networks in the Azure portal.

Option C — Setup a private endpoint to access keyvault (most restrictive): This assumes that config function app and the keyvault are secured by a VNET, in which case, create a private endpoint for the keyvault to be used by the function app.

Cause 2: Secret is missing from Key Vault

Manually create the required secret in Azure Key Vault with the correct value.

  1. Navigate to the Azure Key Vault in the Azure portal.
  2. Go to Secrets and select Generate/Import.
  3. Enter the secret name exactly as shown in the error message.
  4. Provide the correct connection string value.
  5. Set an appropriate activation date if needed, then create the secret.
  6. Restart the Config Function App to force it to reload the secret.

Notes and references