For following all steps in this article, we will need Azure Subscription. If you don’t have an Azure subscription, create a free account before you begin.
We also need to have the LTS versions of Node.js installed on our local development machine. For more information about installing Node.js either directly on Windows or using the Windows Subsystem for Linux (WSL), see Get started with Node.js
Create Azure App Configuration Service
We will need an instance of Azure App Configuration Service. You can refer this article to create one using Azure Portal. Alternatively, you can run the bicep script from this article to create one for you. Refer my GitHub repository to create the resource if you want to use the Bicep files.
The below mentioned keys will be inserted by the script:
Key = TestApi:GetEndpoint:Message, Value = Hello
Key = TestApi:PostEndpoint:Message, Value = Good Morning
Key = TestApi:KeyWithLabel, Value = Value For Key With Label
Now, follow the steps mentioned below:
- Then, install and NPM package @azure/app-configuration.
- Set the environment variable AZURE_APP_CONFIG_CONNECTION_STRING. Its value should be set to read-only connection string.
Run and Verify
Now, if we run the application, we can see that it is able to fetch the value of TestApi:PostEndpoint:Message and printing it on the console.