首页 > 解决方案 > 如何解决 ARM 模板中的“无法加载架构”错误?

问题描述

我正在尝试使用以下 ARM 模板创建资源组。

{
    "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
    "contentVersion": "1.0.0.1",
    "parameters": {
        "rgName": {
            "type": "string"
        },
        "rgLocation": {
            "type": "string"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Resources/resourceGroups",
            "apiVersion": "2018-05-01",
            "location": "[parameters('rgLocation')]",
            "name": "[parameters('rgName')]",
            "properties": {}
        }
    ],
    "outputs": {}
}

参数文件是

 {
  "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "rgName": {
      "value": "sriram"
    },
    "rgLocation": {
      "value": "southcentralus"
    }
  }
}

上面的json文件有没有错误。因为我收到以下错误。

Unable to load schema from 'https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json'. No schema request service available(768)

我忽略了这个错误并尝试在 Azure 管道中运行这些模板并收到以下错误。

"No HTTP resource was found that matches the request URI 'https://management.azure.com/subscriptions/****-****-*****-****/resourcegroups/<Rsource Group Name>/providers/Microsoft.Resources/resourceGroups/<new RG name>?api-version=2018-05-01'

谁能帮我吗?谢谢你。

标签: azureazure-devopsazure-pipelines

解决方案


您的参数文件应将其https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentParameters.json#用作架构参考。


推荐阅读