json 功能App带有MSDeploy的ARM模板

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了json 功能App带有MSDeploy的ARM模板相关的知识,希望对你有一定的参考价值。

{
  "$schema": "http://schemas.management.azure.com/schemas/2015-01-01-preview/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "appName": {
      "type": "string",
      "metadata": {
        "description": "The name of the function app that you wish to create."
      }
    },
    "storageAccountType": {
      "type": "string",
      "defaultValue": "Standard_LRS",
      "allowedValues": [
        "Standard_LRS",
        "Standard_GRS",
        "Standard_ZRS",
        "Premium_LRS"
      ],
      "metadata": {
        "description": "Storage Account type"
      }
    },
    "_artifactsLocation": {
      "type": "string"
    },
    "_artifactsLocationSasToken": {
      "type": "securestring"
    },
    "SampleFunctionAppPackageFolder": {
      "type": "string",
      "minLength": 1,
      "defaultValue": "SampleFunctionApp",
      "metadata": {
        "description": "WebDeploy package location. This path is relative to the _artifactsLocation parameter"
      }
    },
    "SampleFunctionAppPackageFileName": {
      "type": "string",
      "minLength": 1,
      "defaultValue": "package.zip",
      "metadata": {
        "description": "Name of the webdeploy package"
      }
    }
  },
  "variables": {
    "functionAppName": "[parameters('appName')]",
    "hostingPlanName": "[parameters('appName')]",
    "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'azfunctions')]"
  },
  "resources": [
    {
      "type": "Microsoft.Storage/storageAccounts",
      "name": "[variables('storageAccountName')]",
      "apiVersion": "2015-06-15",
      "location": "[resourceGroup().location]",
      "properties": {
        "accountType": "[parameters('storageAccountType')]"
      },
      "tags": {
        "displayName": "Azure Functions Storage Account"
      }
    },
    {
      "type": "Microsoft.Web/serverfarms",
      "apiVersion": "2015-04-01",
      "name": "[variables('hostingPlanName')]",
      "location": "[resourceGroup().location]",
      "properties": {
        "name": "[variables('hostingPlanName')]",
        "computeMode": "Dynamic",
        "sku": "Dynamic"
      },
      "tags": {
        "displayName": "Consumption Plan"
      }
    },
    {
      "apiVersion": "2015-08-01",
      "type": "Microsoft.Web/sites",
      "name": "[variables('functionAppName')]",
      "tags": {
        "displayName": "SampleFunctionApp"
      },
      "location": "[resourceGroup().location]",
      "kind": "functionapp",
      "properties": {
        "name": "[variables('functionAppName')]",
        "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
        "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
      ],
      "resources": [
        {
          "apiVersion": "2016-03-01",
          "name": "appsettings",
          "type": "config",
          "dependsOn": [
            "[resourceId('Microsoft.Web/sites', variables('functionAppName'))]",
            "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
          ],
          "properties": {
            "AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,';')]",
            "AzureWebJobsDashboard": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,';')]",
            "FUNCTIONS_EXTENSION_VERSION": "latest",
            "command": "deploy.cmd"
          }
        },
        {
          "name": "MSDeploy",
          "type": "extensions",
          "location": "[resourceGroup().location]",
          "apiVersion": "2015-08-01",
          "dependsOn": [
            "[resourceId('Microsoft.Web/sites', variables('functionAppName'))]"
          ],
          "tags": {
            "displayName": "SampleFunctionAppPackage"
          },
          "properties": {
            "packageUri": "[concat(parameters('_artifactsLocation'), '/', parameters('SampleFunctionAppPackageFolder'), '/', parameters('SampleFunctionAppPackageFileName'), parameters('_artifactsLocationSasToken'))]",
            "dbType": "None",
            "connectionString": "",
            "setParameters": {
              "IIS Web Application Name": "[variables('functionAppName')]"
            }
          }
        }
      ]
    }
  ]
}

以上是关于json 功能App带有MSDeploy的ARM模板的主要内容,如果未能解决你的问题,请参考以下文章

Team Build:使用 MSDeploy 在本地发布

使用 ARM 模板的带有静态 Header 的 WEBHOOK 类型的事件订阅

使用 msdeploy 转换文件

使用 MSDeploy 为包设置应用程序池

使用 msdeploy 转换文件

msdeploy --- 它有效还是很糟糕?