Configure the .NET Core agent for Azure App Service

You can configure the .NET Core agent for Azure App Service in the Azure Portal, a web.config file or a YAML configuration file.

In Azure Portal, you can configure the .NET Core agent using the environment variable convention of agent configuration. Add all settings to the Application Settings section of the Configuration blade in the Azure Portal using environment variable syntax. For example:

  • To change the agent's logging level (agent.logger.level) to TRACE, add a setting with key CONTRAST__AGENT__LOGGER__LEVEL and value TRACE.

  • To change the agent's server name (server.name) to "MyServer", add a setting with key CONTRAST__SERVER__NAME and value "MyServer".

With a web.config file, you can define any configuration setting as an environment variable. Place your overrides using the environment variable convention in the <environmentVariables> section of <aspNetCore> element. See the Microsoft documentation for more details.

If you are using a YAML configuration file containing Contrast settings, upload the file to your Azure web application by including it in your application deployment or using the Kudu console.

Then, within the Configuration\Application Settings blade, add a new application setting called CONTRAST_CONFIG_PATH with a value that points to this file.

For example, to use the contrast_security.yaml file in the root of your application, add a new application setting with the key CONTRAST_CONFIG_PATH and value of D:\Home\site\wwwroot\contrast_security.yaml in Configuration\Application Settings. Application files in Azure App Service are deployed to D:\home\site\wwwroot.