projectkudu/slingshot

"special name" treatment for 'hostingPlanLocation' as for 'siteLocation'

jfoshee opened this issue · 5 comments

Visual Studio offers a lot of help for editing azuredeploy.json (presumably when the Azure SDK is installed). Slingshot should play nicely with the parameter names generated by the Add Resource wizard.

When adding a Web App resource from the JSON Outline the user gets prompted for two values: the App Service Plan name and the Web App name. Providing hostingPlan and site to those prompts respectively generates a json file that almost has "special names". The "special names" should be consistent with what the wizard generates. Here is a file for example:

{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "hostingPlanName": {
            "type": "string"
        },
        "hostingPlanLocation": {
            "type": "string"
        },
        "hostingPlanSKU": {
            "type": "string",
            "allowedValues": [
                "Free",
                "Shared",
                "Basic",
                "Standard"
            ],
            "defaultValue": "Free"
        },
        "hostingPlanWorkerSize": {
            "type": "string",
            "allowedValues": [
                "0",
                "1",
                "2"
            ],
            "defaultValue": "0"
        },
        "siteName": {
            "type": "string"
        }
    },
    "variables": {
    },
    "resources": [
        {
            "name": "[parameters('hostingPlanName')]",
            "type": "Microsoft.Web/serverfarms",
            "location": "[parameters('hostingPlanLocation')]",
            "apiVersion": "2014-06-01",
            "dependsOn": [ ],
            "tags": {
                "displayName": "hostingPlan"
            },
            "properties": {
                "name": "[parameters('hostingPlanName')]",
                "sku": "[parameters('hostingPlanSKU')]",
                "workerSize": "[parameters('hostingPlanWorkerSize')]",
                "numberOfWorkers": 1
            }
        },
        {
            "name": "[parameters('siteName')]",
            "type": "Microsoft.Web/sites",
            "location": "[parameters('hostingPlanLocation')]",
            "apiVersion": "2014-06-01",
            "dependsOn": [
                "[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
            ],
            "tags": {
                "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
                "displayName": "site"
            },
            "properties": {
                "name": "[parameters('siteName')]",
                "serverFarm": "[parameters('hostingPlanName')]"
            }
        }        
    ],
    "outputs": {
    }
}

(When I say "special names" I'm referring to the bottom of this article: https://elliotthamai.wordpress.com/2014/11/15/using-custom-arm-templates-with-the-deploy-to-azure-button/)

Similar for sku and workerSize.

@jfoshee would you be able to share a sample repo on GitHub that has an azuredeploy.json with those various names? We can add support for them, and having the repo would help validate that it works. Thanks!

Here is a specific commit that I believe should work. You can see in the 5 commits after 40b19 I was fiddling with the deploy file only to get back to par.

Thanks @davidebbo! This illustrates where similar changes could be made. Are you willing to accept pull requests similar in spirit to this?

Sure that would be great!