USING SECURE CONFIGURATION TO STORING SECRETS IN AZURE KEY VAULT AND READING THEM IN AZURE FUNCTIONS – PART 1

  • You can easily secure secrets in Azure Key Vault and read them easily in your Azure Function.
  • For this demo, we are going to use Visual Studio and its Azure Function extension.
  • Let’s go ahead and perform the demo.

Open Visual Studio and go to the Azure Functions extension. Create a new project and choose a location.

Choose C# as the language.

For the template, we are going to use HttpTrigger.

Give your function a unique name.

Go with the default namespace.

Give it anonymous access rights so we can test it easily.

Finally, choose to open the project in current window.

  • Here, I am using Visual Studio code. However, you can also use Visual Studio 2019 as well as you can use the Azure Portal to create your function.

Once the function gets created, add this code. This code reads the application settings called “My Secret” from the functions’ configuration and later on, once we run it, it will show its value in the log.

Next, we will publish the app. Choose a subscription if you have more than one.

Create a new function app in azure with basic settings.

Give the function app a name.

And finally, choose a location to put the function app into.

Next up, we are going to go to the Azure Portal and create an Azure Key Vault there. We will be doing that in part 2.

You can go to the part 2 by click this link.