Reputation: 720
Does anyone know how to change the stack of an Azure WebApp? For instance when one creates a webapp with New-AzWebApp, the default stack is .NET 4.0. How does one switch that to DOTNETCORE without having to revert to using the portal? Also how does one specify the stack at creation without resorting to Resource Templates?
Upvotes: 1
Views: 943
Reputation: 11
Read its current configuration with this
PS> $entityInfo = get-AzWebApp -ResourceGroupName "ResourceGroupName" -Name "Name"
Then go through its properties
PS > $entityInfo.SiteConfig.NetFrameworkVersion
Returns v2.0
PS > $entityInfo.SiteConfig.Use32BitWorkerProcess
Returns True
Update the local copy of the individual settings like this
PS> $entityInfo.SiteConfig.NetFrameworkVersion = "v6.0"
PS> $entityInfo.SiteConfig.Use32BitWorkerProcess = $false
And save it back to the App Service configuration like this
PS> $entityInfo | Set-AzWebAppSlot
Upvotes: 1
Reputation: 42063
As I know, if you use New-AzWebApp
, you could not specify the stack at creation, but you could use the command below to switch that to dotnetcore
after creation.
New-AzWebApp -ResourceGroupName <Resource-Group-Name> -Name <web-app-name> -Location centralus -AppServicePlan <app-service-plan-name>
$PropertiesObject = @{
"CURRENT_STACK" = "dotnetcore"
}
New-AzResource -PropertyObject $PropertiesObject -ResourceGroupName <ResourceGroupName> -ResourceType Microsoft.Web/sites/config -ResourceName "<web-app-name>/metadata" -ApiVersion 2018-02-01 -Force
Check in the portal:
Upvotes: 2