【问题标题】:createUiDefinition.json for ARM Azure web appARM Azure Web 应用程序的 createUiDefinition.json
【发布时间】:2017-05-12 05:45:11
【问题描述】:

我已经为 azure web 应用程序创建了 ARM 模板。我需要将 ARM 模板发布到天蓝色市场。我已使用 azure 发布门户 https://publish.windowsazure.com/workspace/multi-resource-solutions 发布 ARM 模板。

要将 ARM 模板载入 azure 市场 zip 文件,必须包含 mainTemplate.json 和 createUiDefinition.json。我在https://github.com/Azure/azure-quickstart-templates 中找到了一些 createUiDefination.json 文件的示例,但所有的 createUiDefination.json 都是针对 VM 的。我找不到适用于 Azure Web 应用程序的 createUiDefination.json 的示例或教程。

我需要验证 azure web 应用程序站点名称是否已经存在。还需要创建或使用应用服务计划。

有没有为 Azure Web 应用创建 createUiDefination.json 的教程或示例?

【问题讨论】:

  • 在 Azure 市场中部署 Azure Web App 需要哪些 ui 控件?
  • 我什至想知道如何在市场上发布 arm 模板?有关此的任何更新

标签: json azure arm-template azure-marketplace


【解决方案1】:

我需要验证 azure web 应用站点名称是否已存在或 不是。

这是不可能的,你需要给站点名称添加一个唯一的字符串,以确保站点名称是全局唯一的。 例如,你可以在你的 ARM 模板中使用这个函数:uniqueString()

Similar question was answered by a Microsoft employee.

还需要创建或使用应用服务计划。

将应用服务计划添加到您的 Azure 资源管理器模板。比如这样:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "hostingPlanName": {
      "type": "string",
      "minLength": 1
    },
    "skuName": {
      "type": "string",
      "defaultValue": "F1",
      "allowedValues": [
        "F1",
        "D1",
        "B1",
        "B2",
        "B3",
        "S1",
        "S2",
        "S3",
        "P1",
        "P2",
        "P3",
        "P4"
      ],
      "metadata": {
        "description": "Describes plan's pricing tier and capacity. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/"
      }
    },
    "skuCapacity": {
      "type": "int",
      "defaultValue": 1,
      "minValue": 1,
      "metadata": {
        "description": "Describes plan's instance count"
      }
    }
  },
  "variables": {
    "webSiteName": "[concat('webSite', uniqueString(resourceGroup().id))]"
  },
  "resources": [
    {
      "apiVersion": "2015-08-01",
      "name": "[parameters('hostingPlanName')]",
      "type": "Microsoft.Web/serverfarms",
      "location": "[resourceGroup().location]",
      "tags": {
        "displayName": "HostingPlan"
      },
      "sku": {
        "name": "[parameters('skuName')]",
        "capacity": "[parameters('skuCapacity')]"
      },
      "properties": {
        "name": "[parameters('hostingPlanName')]"
      }
    },
    {
      "apiVersion": "2015-08-01",
      "name": "[variables('webSiteName')]",
      "type": "Microsoft.Web/sites",
      "location": "[resourceGroup().location]",
      "tags": {
        "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
        "displayName": "Website"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
      ],
      "properties": {
        "name": "[variables('webSiteName')]",
        "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
      }
    }
  ]
}

【讨论】:

    猜你喜欢
    • 2019-07-29
    • 1970-01-01
    • 2021-01-12
    • 2020-08-23
    • 1970-01-01
    • 1970-01-01
    • 2021-05-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多