【发布时间】:2018-12-14 18:01:15
【问题描述】:
我在沙盒资源组中创建了一个 Azure CosmosDB 资源。 效果很好!
然后我转到“自动化脚本”。
1) 第一个问题,输出这些错误:
Export template operation completed with errors. Some resources were not exported. Please see details for more information. (Code: ExportTemplateCompletedWithErrors)
Could not get resources of the type 'Microsoft.Storage/storageAccounts/managementPolicies'. Resources of this type will not be exported. (Code: ExportTemplateProviderError, Target: Microsoft.Storage/storageAccounts/managementPolicies)
Could not get resources of the type 'Microsoft.Storage/storageAccounts/blobServices'. Resources of this type will not be exported. (Code: ExportTemplateProviderError, Target: Microsoft.Storage/storageAccounts/blobServices)
Could not get resources of the type 'Microsoft.Web/sites/premieraddons'. Resources of this type will not be exported. (Code: ExportTemplateProviderError, Target: Microsoft.Web/sites/premieraddons)
Could not get resources of the type 'Microsoft.Web/sites/sourcecontrols'. Resources of this type will not be exported. (Code: ExportTemplateProviderError, Target: Microsoft.Web/sites/sourcecontrols)
2) 然后我将 JSON 下载到本地文件并将其保存为“./myTemplate.json”。我转到 Azure 门户上的“模板”,然后在 myTemplate.json 中添加 JSON。
3) 第二个问题,我无法验证模板。
在模板部分,我选择我的模板,可以查看 JSON(由 Azure 提供),然后选择 Deploy。 (不应该有Validate除了Deploy吗?)
Deploy 将我带到 Azure 门户中的“自定义部署”视图。我按照步骤操作,然后选择 Purchase,这是模板得到验证的时间。
Deployment template validation failed:
'The template resource '[variables('databaseAccounts_gsdev_name')]' at
line '62'
and column '9' is not valid: Evaluation result of language expression
'[variables('databaseAccounts_gsdev_name')]' is type 'Object', expected
type is 'String'.. Please see https://aka.ms/arm-template-expressions
for usage details.'. (Code: InvalidTemplate)
我也在 Azure DevOps 网站上报告了这个问题: https://developercommunity.visualstudio.com/content/problem/408898/azure-created-arm-is-not-valid-in-azure.html
为什么 Azure 无法从其当前支持的资源创建有效模板?
【问题讨论】:
-
#1 你的第一个问题“这种类型的资源不会被导出”意味着资源不能使用 ARM 模板创建。 #3 你说你“无法验证模板”是不是出错了?如果它没有验证它是不正确的。 #4 无效的模板不允许部署。
-
#1 首先不应该出现,IMO。我可以通过门户创建资源,但 Azure 无法创建 ARM 模板来支持该资源?这是一个很大的矛盾。 #3 我试图提供更多细节。感谢您提出这个问题。
-
您可以通过转到门户选择资源然后选择自动化刀片来进行测试。您将在模板顶部看到一条通知,通知您某些资源无法通过 ARM 模板进行部署。至于这是否应该成为一个问题……我必须同意你的看法。您可以做的最好的事情是删除资源并通过脚本或门户在 ARM 模板部署后部署它们。
标签: azure azure-cosmosdb azure-resource-manager