gpt4 book ai didi

json - ARM Azure Web 应用程序的 createUiDefinition.json

转载 作者:行者123 更新时间:2023-12-01 18:05:58 29 4
gpt4 key购买 nike

我已经为 azure Web 应用程序创建了 ARM 模板。我需要将 ARM 模板发布到 azure 市场。我使用了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 的教程或示例?

最佳答案

I need to validate the azure web app site name is already exists or not.

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

Similar question was answered by a Microsoft employee.

Also need to create or use the app service plan.

将应用服务计划添加到 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'))]"
}
}
]
}

关于json - ARM Azure Web 应用程序的 createUiDefinition.json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43930117/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com