How can I execute Azure Powershell command New-AzWebApp to have .NET Core as Stack selected? I can not see any parameter and documentation that could help. https://learn.microsoft.com/en-us/powershell/module/az.websites/New-AzWebApp?view=azps-2.6.0
1 Answer
You could not set it with only this command, the New-AzWebApp
does not support to do that. You need to use New-AzWebApp
to create the web app and use New-AzResource
to set the CURRENT_STACK
with dotnetcore
.
Try the command as below, it works fine on my side.
New-AzWebApp -ResourceGroupName <ResourceGroupName> -Name <web-app-name> -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
Note: If you have set other properties in the metadata
, like Deployment Center source, you also need to include them in the $PropertiesObject
, becasue the command will overwrite $PropertiesObject
.
Besides, to check the properties of the metadata of your web app, you could use the command as below.
$resource = Invoke-AzResourceAction -ResourceGroupName <ResourceGroupName> -ResourceType Microsoft.Web/sites/config -ResourceName "<web-app-name>/metadata" -Action list -ApiVersion 2018-02-01 -Force
$resource.Properties