question

SoftwareDeveloper-8088 avatar image
0 Votes"
SoftwareDeveloper-8088 asked ·

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

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
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

bhargaviannadevara-msft avatar image
0 Votes"
bhargaviannadevara-msft answered ·

@SoftwareDeveloper-8088 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:

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.