How to read azure application setting and connection string in Angular?

Software Developer 21 Reputation points
2021-03-17T05:14:20.783+00:00

I want to read the azure application setting of the azure app service in angular for the solution of multiple environments in angular.

Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
230 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. BhargaviAnnadevara-MSFT 5,466 Reputation points
    2021-03-17T07:34:49.737+00:00

    @Software Developer You can use the Azure App Configuration Service to centrally manage application settings and feature flags for your app.

    There is a npm package available for Azure App Configuration Service here: https://www.npmjs.com/package/@azure/app-configuration, which can be used as follows:

       const appConfig = require("@azure/app-configuration");  
         
       const client = new appConfig.AppConfigurationClient(  
         "<App Configuration connection string goes here>"  
       );  
         
       async function run() {  
         const newSetting = await client.setConfigurationSetting({  
           key: "testkey",  
           value: "testvalue",  
           label: "optional-label"  
       });  
         
       let retrievedSetting = await client.getConfigurationSetting("testkey", {  
           label: "optional-label"  
       });  
         
       console.log("Retrieved value:", retrievedSetting.value);  
       }  
         
       run().catch((err) => console.log("ERROR:", err));  
    

    However, please be aware of the caveats with regards to security and performance that come with using App Config on the client-side, as described in the following posts:

    Additional resources:


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.