How to set Azure Web App Stack using Azure PowerShell

In this blog post, we will focus on setting up the Azure Web App stack using Azure PowerShell.

Azure Web Apps is a fully managed platform that allows developers to build, deploy, and scale web apps quickly and easily.

The Azure Web App Stack provides a wide range of options for developers to choose from, including programming languages like .NET, Java, Node.js, and PHP, along with a variety of frameworks like ASP.NET, Spring, and Laravel.

Install Az Module and Connect

Before we begin, make sure you have Azure PowerShell installed on your machine. You can download and install it from the PowerShell Gallery using the following command:

Install-Module -Name Az -AllowClobber

To connect to Microsoft Azure using PowerShell run the following command.

connect-azaccount -Device

Stack Option

Currently, Azure Web Apps offer a number of stacks that you can use to deploy your apps into. In the code below, I’m setting the stack to Python 3.11. If you need to set a different stack, follow the same syntax with the stack details.

Azure PowerShell Script

To set the stack, you will need the details of your resource group and Web App name. Set them in the variables section and run the script.

# Set Variables
$rg="Web-Linux"
$webApp_name="ntwWeb00090002"

# Set Stack version
$PropertiesObject = @{

    linuxFxVersion =  "PYTHON|3.11";
}

Set-AzResource -PropertyObject $PropertiesObject -ResourceGroupName $rg -ResourceType Microsoft.Web/sites/config -ResourceName $webApp_name/web 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.