PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, August 19, 2022

[FIXED] How to override web.config values in custom section in Azure Web App?

 August 19, 2022     azure, azure-web-app-service, environment-variables, web-config     No comments   

Issue

It is possible in Azure Web App to override web.config AppSettings section easily. E.g. if I have the following web.config:

<appSettings>   
    <add key="AllowedCORSOrigin" value="http://localhost:26674"/>
</appSettings>

I can override it in the app settings UI in the portal like that:

enter image description here

I have also a custom section in the web.config:

<AdWordsApi>
    <add key="OAuth2RefreshToken" value="TOKEN" />
</AdWordsApi>

Is it possible to override it somehow as well? I have tried AdWordsApi.OAuth2RefreshToken and AdWordsApi:OAuth2RefreshToken, but that does not work that easily.

P.S. It's interesting to know if it's possible with other custom sections like e.g if I want another authentication mode on the server.

<system.web>
    <authentication mode="None" />
</system.web>

Solution

Short answer is that it is not possible.

The mechanism you describes only works with App Settings and Connection Strings. High level, the way it works is:

  • Your Azure App Settings become environment variables
  • At runtime, a special module sets those dynamically in the .NET config system. Note that the physical web.config is never modified.

But it would be hard to make such mechanism work on arbitrary config sections, as those could not be dynamically affected without modifying the physical file.



Answered By - David Ebbo
Answer Checked By - Mildred Charles (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing