0

I have two Azure Functions sharing a single KeyVault. Both Functions use KeyVault references in local.settings.json rather than plaintext secrets. Each function uses a different internal Azure Storage account (AzureWebJobStorage).

  • How do I reference two different AzureWebJobStorage app settings using one KeyVault?
  • Is there a way to change one of the settings to AzureWebJobStorage1 or the like?
ericOnline
  • 1,586
  • 1
  • 19
  • 54

2 Answers2

1

As far as I know, using Azure Key Vault references with Azure Functions does not support to work on local. for more details, you can refer to this post.

The following answers are based on the functions on the Azure Portal

How do I reference two different AzureWebJobStorage app settings using one KeyVault?

You need to add the storage connect string you need to the key vault on the Azure portal, and it will generate the corresponding Secret Identifier.

enter image description here

enter image description here

You can generate references that conform to the following syntax:

@Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/mysecret/ec96f02080254f109c51a1f14cdb1931)

Then add these two references to the app setting

enter image description here

Is there a way to change one of the settings to AzureWebJobStorage1 or the like?

Of course, if you configure the key vault reference in the app setting, you can define your variable name as AzureWebJobStorage1.

enter image description here

Take the blob trigger function as an example, you can use AzureWebJobStorage1 in the function.json file to get the storage connection.

enter image description here

Frank Borzage
  • 6,292
  • 1
  • 6
  • 19
  • Thank you for the reply. I'm speaking about the INTERNAL Storage Used by the Function NOT the trigger. The INTERNAL storage has a default name of `AzureWebJobsStorage`. If I have two Functions sharing the same KeyVault, I can't have the same secret name. How can I handle this? – ericOnline Aug 14 '20 at 14:13
0

I was being silly. It doesn't matter what the Key Vault secret is named. The AzureWebJobsStorage name stays the same in each function, but can be called anything in Key Vault.

ericOnline
  • 1,586
  • 1
  • 19
  • 54