Skip to content Skip to sidebar Skip to footer

Accessing Azure Application Settings With Javascript

I am hosting my website with Microsoft Azure. I have set up a few Application Settings (which should act as Environment Variables) for a secret key and ClientID for some GET reques

Solution 1:

NEWEST

This api need add bear token to request.

According to your description, your project is only html+js, which is originally a static resource, hard coding will definitely cause security issues. But you will be much safer using rest api now.

Because you first need to obtain the bear token, you need to refer to the official documentation for details.

Microsoft identity platform and OAuth 2.0 authorization code flow

If you want to make minimal changes to the project, you may need to use ROPC flow. You can refer my another in another post.

enter image description here

PRIVIOUS

You can use rest api to get application settings.

The JavaScript script in Html does not support node usage. The syntax of process.env.CLIENT_ID is suitable for use in complete nodejs projects. It is recommended to use restapi to get the value of the application settings you want.

My custom settings in portal.

enter image description here

You can access this site. Web Apps - List Application Settings.

enter image description here

Post a Comment for "Accessing Azure Application Settings With Javascript"