skip to Main Content

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


  1. 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:

    The Secret Manager tool doesn’t encrypt the stored secrets and shouldn’t be treated as a trusted store. It’s for development purposes only. The keys and values are stored in a JSON configuration file in the user profile directory.

    (source

    If you need to access secrets from your function you should use the Azure Key Vault:

    Azure Key Vault is a service that provides centralized secrets management, with full control over access policies and audit history. You can use a Key Vault reference in the place of a connection string or key in your application settings. To learn more, see Use Key Vault references for App Service and Azure Functions.

    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.

    Login or Signup to reply.
  2. When you deploy an Azure Function, the secrets stored in secrets.json are not automatically transferred to Azure. The secrets.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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search