Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deployment Template sample with Virtual Applications and Virtual Directories
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Web/serverfarms",
"kind": "app",
"name": "LoremIpsumAppService",
"sku": {
"name": "B1"
},
"apiVersion": "2015-08-01",
"location": "[resourceGroup().location]",
"properties": {
"name": "LoremIpsumAppService",
"numberOfWorkers": 1
},
"resources": [
{
"type": "Microsoft.Web/sites",
"kind": "app",
"name": "LoremIpsumWebApp",
"apiVersion": "2015-08-01",
"location": "[resourceGroup().location]",
"properties": {
"name": "LoremIpsumWebApp"
},
"resources": [
{
"type": "Microsoft.Web/sites/config",
"name": "LoremIpsumWebApp/web",
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', 'LoremIpsumWebApp')]"
],
"properties": {
"phpVersion": "",
"alwaysOn": "true",
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\\wwwroot",
"virtualDirectories": null
},
{
"virtualPath": "/DolorSitAmet",
"physicalPath": "site\\dolor-sit-amet",
"virtualDirectories": [
{
"virtualPath": "/Images",
"physicalPath": "site\\path-to\\images"
}
]
}
]
}
}
],
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'LoremIpsumAppService')]"
]
}
]
}
]
}
@vancourse

This comment has been minimized.

Copy link

vancourse commented May 11, 2018

Awesome example, very helpful.. thank you!

Do you have an example that shows how to create multiple virtual directories, from an array?

  "virtualdirectories": {
            "value": {
                "directories": [
                    {
                        "virtualpath": "vd1",
                        "physicalpath": "site\\pd1"
                    },
                    {
                        "virtualpath": "vd2",
                        "physicalpath": "site\\pd2"
                    }
                ]
            }
        }
@vladislav-mitev

This comment has been minimized.

Copy link

vladislav-mitev commented Jan 24, 2019

Hello, thanks for the example.
In your post, at the end you suggest "... and then configure a Web Deploy to your brand new Virtual Application!".
Could you please show how to configure an MSDeploy templated to deploy code to the virtual path of the virtual application?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.