Updating runtime stack of Azure Web App (Windows)
To host a project/application on Azure we have a lot of options. One of them is the managed service that azure provides — Web Apps. This post will not go through the steps to set up the application but instead of changing the target framework or the runtime stack of the web app.
By default Azure creates the web app with the runtime stack as .Net. And that usually works if the application you are deploying is a .net framework application. Incase we are deploying Python or PHP or a Java app to Azure then changing the runtime might come in handy.
You can use the following two methods to change the runtime stack.
Using Azure Portal
Login to the Azure portal and traverse to the web app. Go to Configuration and then you would find the framework details under General Settings.
Click and choose the relevant runtime you want.
Using Azure CLI:
There might be cases where you need to automate the update of runtime stack as going to a portal is tedious incase you are dealing with a number of web apps on Azure.
To update the framework using cli you can run the following command.
$ResourceGroupName = "RGName"
$WebAppName = "WebAppName"
$JavaContainer = "JAVA"
$JavaContainerVersion = "SE"
$JavaVersion = "1.8"
$PhpVersion = "7.0"
$PythonVersion = "3.4.0"#Change the framework to JAVA
az webapp config set -g $ResourceGroupName -n $WebAppName --java-container $JavaContainer --java-container-version $JavaContainerVersion --java-version $JavaVersion#Change the framework to PHP
az webbapp config set -g $ResourceGroupName -n $WebAppName --php-version $PhpVersion#Change the framework to Python
az webapp config set -g $ResourceGroupName -n $WebAppName --python-version $PythonVersion
Accepted values for the parameters and runtime stack versions are below:
— java-version
The accepted values currently are 1.8, 11. The value 1.8 is for Java 8 and 11 corresponds to Java 11.
— java-container
The values for this are JAVA, TOMCAT.
— java-container-version
The values for this are SE, 9.0, 8.5, 7.0. The value SE is for Embedded Web Server and other versions are for Tomcat.
— php-version
The values are 5.5, 5.6, 7.0.
— python-version
The accepted values are 3.4.0, 2.7.0.