簡體   English   中英

適用於ARM Azure Web應用程序的createUiDefinition.json

[英]createUiDefinition.json for ARM Azure web app

我為azure web app創建了ARM模板。 我需要將ARM模板發布到azure市場。 我使用azure發布門戶https://publish.windowsazure.com/workspace/multi-resource-solutions來發布ARM模板。

要將ARM模板安裝到azure market place,zip文件必須包含mainTemplate.json和createUiDefinition.json。 我在https://github.com/Azure/azure-quickstart-templates中找到了createUiDefination.json文件的一些示例,但所有createUiDefination.json都是針對VM的。 我無法為Azure Web應用程序找到createUiDefination.json的示例或教程。

我需要驗證azure web app網站名稱是否已存在。 還需要創建或使用應用服務計划。

是否有任何教程或示例用於為azure Web應用程序創建createUiDefination.json?

我需要驗證azure web app網站名稱是否已存在。

這是不可能的,您需要在站點名稱中添加唯一的String,以確保站點名稱是全局唯一的。 例如,您可以在ARM模板中使用此函數: uniqueString()

微軟員工回答了類似的問題。

還需要創建或使用應用服務計划。

將應用服務計划添加到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'))]"
      }
    }
  ]
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM