Azure / Azure/static-web-apps

Azure Functions that ship with Static Web Apps do not support Key Vault References

Open
#1,090 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

Whilst Azure Static Web Apps do support Key Vault references, the Azure Functions that ship with SWAs do not.

See possibly related https://github.com/Azure/Azure-Functions/issues/2248

**To Reproduce**

Use the same config as described in #1089, but this time pass through some key vault references to the function app:

```bicep
module staticWebApp 'static-sites.bicep' = {
name: '${deploymentPrefix}-how-you-doin-${branchHash}'
params: {
appSettings: {
// THESE WILL WORK FINE
AAD_CLIENT_ID: aadClientIdRef
AAD_CLIENT_SECRET: aadClientSecretRef
}
functionAppAppSettings: {
APPINSIGHTS_INSTRUMENTATIONKEY: appInsights.properties.InstrumentationKey
APPLICATIONINSIGHTS_CONNECTION_STRING: appInsights.properties.ConnectionString
telemetryDbKeyRef: telemetryDbKeyRef // ** Here is a Key Vault reference
telemetryDbDatabaseName: telemetryDbDatabaseName
telemetryDbContainerName: telemetryDbContainerName
telemetryDbEndpoint: telemetryDbAccountDb.properties.documentEndpoint
}
location: location
repositoryBranch: repositoryBranch
repositoryUrl: repositoryUrl
staticSiteName: staticSiteName
tags: tagsWithHiddenLinks
customDomainName: (repositoryBranch == 'main') ? customDomainName : ''
}
}
```

Create an Azure Function which `context.log`s your KeyRef (`telemetryDbKeyRef`). You'll see that rather than logging out your key ref value, it just logs out the verbatim key ref:

```
@Microsoft.KeyVault(VaultName=kv-kv-2mb9k5bwz8-dev;SecretName=telemetryDbKey)
```

**Expected behavior**

The AppSettings at runtime to be populated with the key value values

**Screenshots**
N/A

**Device info (if applicable):**
N/A

**Additional context**
Happy to demo this issue to you.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.