I’ve created an Azure function app using Visual Studio and along with it I created a secrets.json
file. I added:
.ConfigureAppConfiguration(con =>
{
con.AddUserSecrets<Program>(optional: true, reloadOnChange: false);
})
to the host builder. I have deployed the function to Azure, but one of the secrets, holds a local value to an sshkey that I had stored on my local drive. I probably need to change this to a server address, but cannot find where these values are stored on azure. Can someone point me where I need to go please.
2
Answers
User secrets on your development machine are stored in your profile folder. The secret.json file is not meant to be deployed outside your local development environment:
(source
If you need to access secrets from your function you should use the Azure Key Vault:
Normally the secret.json file is not stored in the ouput folder upon build so it wouldn’t be deployed to the azure function, which is a good thing.
When you deploy an Azure Function, the secrets stored in
secrets.json
are not automatically transferred to Azure. Thesecrets.json
file is used for local development only. To manage sensitive information in Azure, you should use Azure Key Vault or application settings in the Azure portal.Recommendations
Azure Key Vault:
Application Settings:
After updating your secret on either Azure Key Vault or application settings, modify your Azure Function’s code to retrieve the new secret values accordingly.