I hope you can help me with the following situation.
We want to deploy an Azure Web App on some sub-applications / virtual-applications. However, what We have researched on the internet has not been very precise with the technique required for this, but I doubt that it cannot be done using ARM.
We appreciate if anyone has information that leads us to achieve the objective or if it is impossible using this technique or it is an Azure bug.
We have tried setting the “IIS Web Application Name” to
- “[parameters(‘appName’)]/subapp1”
- “/subapp1”
- “subapp1”
- “Default Web Site/subapp1”
We have used extensions:
- MSDeploy,
- addOnPackages and
- ZipDeploy
And the result is always the same, the files remain on the root of the web application.
This is the ARM template that we are using:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"metadata": {
"description": "Location of resources"
},
"defaultValue": "[resourceGroup().location]"
},
"_artifactsLocation": {
"type": "string",
"metadata": {
"description": "The base URI where artifacts required by this template are located including a trailing "https://stackoverflow.com/""
},
"defaultValue": "[deployment().properties.templateLink.uri]"
},
"_artifactsLocationSasToken": {
"type": "securestring",
"metadata": {
"description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated. Use the defaultValue if the staging location is not secured."
},
"defaultValue": ""
},
"appName": {
"type": "string",
"metadata": {
"description": "App Name"
},
"defaultValue": "testapp123"
}
},
"variables": {
"existingPlanAppServiceName": "[concat('PlanAppService-',uniqueString(resourceGroup().id))]"
},
"resources": [
{
"apiVersion": "2022-03-01",
"name": "[variables('existingPlanAppServiceName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[parameters('location')]",
"kind": "",
"tags": {},
"dependsOn": [],
"properties": {
"name": "[variables('existingPlanAppServiceName')]",
"workerSize": "18",
"workerSizeId": "18",
"numberOfWorkers": "1",
"zoneRedundant": false
},
"sku": {
"Tier": "Premium0V3",
"Name": "P0V3"
}
},
{
"apiVersion": "2022-03-01",
"name": "[parameters('appName')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('location')]",
"tags": {},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('existingPlanAppServiceName'))]"
],
"properties": {
"name": "[parameters('appName')]",
"siteConfig": {
"metadata": [
{
"name": "CURRENT_STACK",
"value": "dotnet"
}
],
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\\wwwroot",
"preloadEnabled": false
},
{
"virtualPath": "/subapp1",
"physicalPath": "site\\wwwroot\\subapp1",
"preloadEnabled": true
}
],
"phpVersion": "OFF",
"netFrameworkVersion": "v4.0",
"alwaysOn": true,
"ftpsState": "Disabled",
"use32BitWorkerProcess": false,
"http20Enabled": true,
"websiteTimeZone": "SA Pacific Standard Time"
},
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('existingPlanAppServiceName'))]",
"clientAffinityEnabled": false,
"httpsOnly": true,
"publicNetworkAccess": "Enabled"
},
"resources": [
{
"type": "Microsoft.Web/sites/extensions",
"apiVersion": "2022-03-01",
"name": "[concat(parameters('appName'), '/MSDeploy')]",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('appName'))]"
],
"properties": {
"packageUri": "[uri(concat(parameters('_artifactsLocation'),'filesApp.zip'),parameters('_artifactsLocationSasToken'))]",
"dbType": "None",
"connectionString": "",
"appOffline": true,
"setParameters": {
"IIS Web Application Name": "[concat(parameters('appName'),'/subapp1')]"
}
}
}
]
}
]
}
Thank you very much for your help in advance.
Your code looks good for me as per the requirement. Rather than depending on the
MSDeploy
extension’s"IIS Web Application Name"
argument, you can try setting the virtual application directly in theMicrosoft.Web/sites
resource undersiteconfig
. Have you tried that way. @Frank Leao