Azure: How to reload the Environment Variables without rebooting the App Service - azure

What I’m trying to achieve:
In an ASP.NET Core Web App, I want to listen for the configuration change event, and reload the new configuration value at run time. I'm changing the configuration setting by using the following CLI operation:
For Example:
az webapp config appsettings set --name $WebAppName --slot $SlotName --resource-group $ResourceGroupName --settings A_Setting_To_Monitor=$NewSettingValue
How can I detect this change event and load the new configuration value without resetting the App Service?
I'm using C# and .NET Core 2.1.

Have a look at Azure App Configuration.
Azure App Configuration provides a service to centrally manage application settings. Modern programs, especially programs running in a cloud, generally have many components that are distributed in nature. Spreading configuration settings across these components can lead to hard-to-troubleshoot errors during an application deployment. Use App Configuration to store all the settings for your application and secure their accesses in one place.
App Configuration makes it easier to implement the following scenarios:
Centralized management and distribution of hierarchical configuration data for different environments and geographies
Dynamic configuration changes without the need to redeploy or restart an application
Feature management

Related

stdout log files are empty in azure web service

I have created an azure web service app used for testing purposes and run into a .Net / http issue (500.30). Ive looked into a lot of troubleshooting but nothing has worked or pointed me in the right direction.
It seems to get more info on the issue, I can use the stdout logs in the Azure app service through Kudu. This has been configured this and the files it creates are blank? Has anyone encountered this before?
What have I did, I set it up in the web.config file setting the stdlog to true but this creates the files with no info. I then removed the inprocess=hosting section as I read this fixed it for others but no joy.
Any pointers in the right direction would be appreciated
HTTP Error 500.30, The log file is created but empty - This kind of scenario is trapped by the SDK when publishing a self-contained app.
There is a term called RID (Runtime Identifier) used to identify target platforms where a .NET Core application runs.
If the RID doesn't match the platform target then the SDK produces the above kind of errors.
For example, win10-x64 RID with <PlatformTarget>x86</PlatformTarget> in the project file.
Troubleshooting steps:
<PlatformTarget>x86</PlatformTarget> enables the IIS app pool for 32-bit apps in an x86 framework-dependent deployment and set Enable 32-bit Apps to True from the app pool's Advanced Settings of IIS Manager.
500.30 is In-Process Startup Failure as it's cause can be usually determined from entries in the Application Event Log and the ASP .NET Core Module stdout log.
The app is misconfigured due to targeting a version of the ASP .NET Core shared framework that isn't present. Check which versions of the ASP .NET Core Shared framework are installed on the target machine.
If you're using Azure Key Vault, check the policies in the targeted Key Vault to ensure that the correct permissions are granted.
Also, please visit this Thread related to logging not working fix.
And Application Insights should be enabled to get the log files in the Storage account.
You can stream the logs from the portal or using CLI:
az webapp log tail --name appname --resource-group myResourceGroup
Use this reference to get the logs using the simple queries.
You need to enable application logging first.
Click on the App Service logs menu
In Application logging, select File System
In Quota (MB), specify the disk quota for the application logs. In Retention Period (Days), set the number of days the logs should be retained.
Save
You can stream the logs from the portal or by using the CLI
az webapp log tail --name appname --resource-group myResourceGroup

Deploy applications to Azure

At the company that i work, they deploy applications to azure using Azure App Services.
This involves creating the App service manually, and setting up the pipelines manually.
My question is if there is another way to host and run applications in Azure without using App Services?
The reason for this is that i don't like the manually work when setting up a app service and all it's configuration.
Any suggestions?
What you actually need is setting up CI/CD pipelines for your application to create resource(AppService in this case) and deploy on them.
If you are new to Azure Devops, i would highly recommend to explore Devops starter service to deploy your application with few clicks and see how it creates resources and pipelines automatically
On the 2nd question, there are many compute options available on Azure such as Virtual Machines , AKS (Containers Orchestration) , Container instances etc.
You can explore those compute options using the decision tree here

Using terraform to deploy a Spring boot azurerm_app_service with upload of jar

I have been attempting this for a good chunk of today but still have not found a solution.
I have a built spring boot application in the form of a jar.
I push this to a storage account container as a blob with azurerm_storage_blob
I reference this from a azurerm_app_service in app_settings.WEBSITE_RUN_FROM_PACKAGE using a data.azurerm_storage_account_sas
I see that it has pulled the blob from storage in the app-service but it has exploded it under D:\home\site\wwwroot
I have set site_config.java* (java_version, java_container and java_container_version) but it makes no attempt to start the application
I see there is a site_config.app_command_line but none of the examples I have found set this.
Has anybody gotten a spring boot application in a windows app service running using terraform?
Is there a better way to get the application jar to azure using terraform?
There are various ways to deploy your application to Azure App Service. For your scenario, I recommend not to set WEBSITE_RUN_FROM_PACKAGE and make sure your executable jar is called app.jar and it is dropped to the root of your Web App's content folder (/site/wwwroot).
App Service will automatically take care of setting the appropriate SERVER_PORT environment variable behind the scenes, so that when your Spring Boot application starts, it will start listening to the correct port.
If you need to set parameters, you can always set JAVA_OPTS in the App Service Settings section in the Azure portal and those will travel as environment variables and ultimately used by java.exe upon start.
If you hit any rough edge, feel free to open a ticket in Azure portal and we will be able to assist you better to make sure your app runs well in Azure App Service.
Other popular mechanism to deploy is using Maven:
https://learn.microsoft.com/en-us/azure/java/spring-framework/deploy-spring-boot-java-app-with-maven-plugin

Azure App Services Deployment Slot Transformations

I would like to start using the deployment slots in my Azure App Services for a staging to production task. The problem that I am running into is I can't seem to find a way to do transformations on the web.config outside of the appsetting and connectionstrings. I seem to be missing something, but I need to be able to adjust other configurations, from logging levels, to other integrated config sections.
We currently have been using direct deployments from our build server with msdeploy and Parameters.xml file to do much of this work, however that won't work with deployment slots.
When you create the additional deployment slot, you can clone all settings from the existing instance, or dont copy anything. As per documentation:
"You can clone configuration from any existing slot. Settings that can
be cloned include app settings, connection strings, language framework
versions, web sockets, HTTP version, and platform bitness."
In the new deployment slot, under Settings > Configuration, you can specify any settings here to be specific to the new deployment slot by selecting "Deployment slot setting".

Appsettings in Service Fabric (ASP.NET Core)

Is it possible to update appsettings and connection strings at runtime in Service Fabric like it is possible in Azure App Services?
The only similar solution I can find involves updating the VM Scale Set (VMSS), which sets environment variables to each VM in the scale set as far as I understand, and I am not interested in applications sharing these variables.
An alternative solution could be to update appsettings.json and deploy a new version, but I would prefer being able to do this.
There is no way to do a global config change. Configuration for a service should be included in the service's configuration package and changed as a versioned, rolling upgrade.

Resources