{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "SitesEshopfunctionsName": {
            "type": "string",
            "metadata": {
                "description": "Name of the Azure Functions namespace"
            },
            "defaultValue": "mktfunctionsdemo"
        }
    },
    "variables": {
		"SitesEshopfunctionsName": "[parameters('SitesEshopfunctionsName')]",
		"WebConfigName": "[concat(variables('SitesEshopfunctionsName'), '/web')]",
		"Location": "[resourceGroup().location]",
		"ServerFarmPlan": "[concat(trim(variables('location')), 'Plan')]",
		"StorageAccounts": "[concat(variables('SitesEshopfunctionsName'), 'st')]"
    },
    "resources": [        
        {
            "type": "Microsoft.Storage/storageAccounts",
            "sku": {
                "name": "Standard_LRS",
                "tier": "Standard"
            },
            "kind": "Storage",
            "name": "[variables('StorageAccounts')]",
            "apiVersion": "2016-01-01",
            "location": "[variables('Location')]",
            "tags": {},
            "scale": null,
            "properties": {},
            "dependsOn": []
        },
        {
            "type": "Microsoft.Web/serverfarms",
            "sku": {
                "name": "Y1",
                "tier": "Dynamic",
                "size": "Y1",
                "family": "Y",
                "capacity": 0
            },
            "kind": "functionapp",
            "name": "[variables('ServerFarmPlan')]",
            "apiVersion": "2015-08-01",
            "location": "[variables('Location')]",
            "scale": null,
            "properties": {
                "name": "[variables('ServerFarmPlan')]",
                "numberOfWorkers": 0
            },
            "dependsOn": []
        },
        {
            "type": "Microsoft.Web/sites",
            "kind": "functionapp",
            "name": "[variables('SitesEshopfunctionsName')]",
            "apiVersion": "2015-08-01",
            "location": "[variables('Location')]",
            "scale": null,
            "properties": {
                "name": "[variables('SitesEshopfunctionsName')]",
                "hostNames": [
                    "[concat(variables('SitesEshopfunctionsName'),'.azurewebsites.net')]"
                ],
                "enabledHostNames": [
                    "[concat(variables('SitesEshopfunctionsName'),'.azurewebsites.net')]",
                    "[concat(variables('SitesEshopfunctionsName'),'.scm.azurewebsites.net')]"
                ],
                "hostNameSslStates": [
                    {
                        "name": "[concat(variables('SitesEshopfunctionsName'),'.azurewebsites.net')]",
                        "sslState": 0,
                        "thumbprint": null,
                        "ipBasedSslState": 0
                    },
                    {
                        "name": "[concat(variables('SitesEshopfunctionsName'),'.scm.azurewebsites.net')]",
                        "sslState": 0,
                        "thumbprint": null,
                        "ipBasedSslState": 0
                    }
                ],
                "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('ServerFarmPlan'))]"
            },
            "dependsOn": [
                "[resourceId('Microsoft.Web/serverfarms', variables('ServerFarmPlan'))]"
            ]
        },
        {
            "type": "Microsoft.Web/sites/config",
            "name": "[variables('WebConfigName')]",
            "apiVersion": "2015-08-01",
            "location": "[variables('Location')]",
            "scale": null,
            "properties": {
                "numberOfWorkers": 1,
                "defaultDocuments": [
                    "Default.htm",
                    "Default.html",
                    "Default.asp",
                    "index.htm",
                    "index.html",
                    "iisstart.htm",
                    "default.aspx",
                    "index.php",
                    "hostingstart.html"
                ],
                "netFrameworkVersion": "v4.0",
                "phpVersion": "5.6",
                "pythonVersion": "",
                "nodeVersion": "",
                "linuxFxVersion": "",
                "requestTracingEnabled": false,
                "remoteDebuggingEnabled": false,
                "remoteDebuggingVersion": null,
                "httpLoggingEnabled": false,
                "logsDirectorySizeLimit": 35,
                "detailedErrorLoggingEnabled": false,
                "publishingUsername": "$eshopfunctions",
                "publishingPassword": null,
                "appSettings": null,
                "metadata": null,
                "connectionStrings": null,
                "machineKey": null,
                "handlerMappings": null,
                "documentRoot": null,
                "scmType": "None",
                "use32BitWorkerProcess": true,
                "webSocketsEnabled": false,
                "alwaysOn": false,
                "javaVersion": null,
                "javaContainer": null,
                "javaContainerVersion": null,
                "appCommandLine": "",
                "managedPipelineMode": 0,
                "virtualApplications": [
                    {
                        "virtualPath": "/",
                        "physicalPath": "site\\wwwroot",
                        "preloadEnabled": false,
                        "virtualDirectories": null
                    }
                ],
                "winAuthAdminState": 0,
                "winAuthTenantState": 0,
                "customAppPoolIdentityAdminState": false,
                "customAppPoolIdentityTenantState": false,
                "runtimeADUser": null,
                "runtimeADUserPassword": null,
                "loadBalancing": 1,
                "routingRules": [],
                "experiments": {
                    "rampUpRules": []
                },
                "limits": null,
                "autoHealEnabled": false,
                "autoHealRules": {
                    "triggers": null,
                    "actions": null
                },
                "tracingOptions": null,
                "vnetName": "",
                "siteAuthEnabled": false,
                "siteAuthSettings": {
                    "enabled": null,
                    "unauthenticatedClientAction": null,
                    "tokenStoreEnabled": null,
                    "allowedExternalRedirectUrls": null,
                    "defaultProvider": null,
                    "clientId": null,
                    "clientSecret": null,
                    "issuer": null,
                    "allowedAudiences": null,
                    "additionalLoginParams": null,
                    "isAadAutoProvisioned": false,
                    "googleClientId": null,
                    "googleClientSecret": null,
                    "googleOAuthScopes": null,
                    "facebookAppId": null,
                    "facebookAppSecret": null,
                    "facebookOAuthScopes": null,
                    "twitterConsumerKey": null,
                    "twitterConsumerSecret": null,
                    "microsoftAccountClientId": null,
                    "microsoftAccountClientSecret": null,
                    "microsoftAccountOAuthScopes": null
                },
                "cors": {
                    "allowedOrigins": [
                        "https://functions.azure.com",
                        "https://functions-staging.azure.com",
                        "https://functions-next.azure.com"
                    ]
                },
                "push": null,
                "apiDefinition": null,
                "autoSwapSlotName": null,
                "localMySqlEnabled": false,
                "ipSecurityRestrictions": null
            },
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', variables('SitesEshopfunctionsName'))]"
            ]
        }
    ]
}