gpt4 book ai didi

Azure - 未找到与请求 URI 匹配的 HTTP 资源

转载 作者:行者123 更新时间:2023-12-03 04:48:16 28 4
gpt4 key购买 nike

我正在使用 YAML 管道从 Azure Devops 创建资源组。下面是我在管道中使用的 Azure 任务的片段。

- task: AzureResourceGroupDeployment@2
displayName: 'Deploy RG'
inputs:
azureSubscription: 'my-servicePrinciple (SPN)'
resourceGroupName: 'test-rg-001'
location: 'westeurope'
templateLocation: 'Linked artifact'
csmFile: $(Pipeline.Workspace)/arm_templates/ResourceGroup/template.json
csmParametersFile: $(Pipeline.Workspace)/arm_templates/ResourceGroup/parameter.json
deploymentMode: Incremental

这是我的 template.json 文件的内容

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

管道失败并出现以下错误。

No HTTP resource was found that matches the request URI 'https://management.azure.com/subscriptions/xx4873gx-4yy1-4092-9a70-34812353vv77/resourcegroups/test-rg-001/providers/Microsoft.Resources/resourceGroups/test-rg-001?api-version=2020-06-01'

我在互联网上查找造成这种情况的原因,但没有希望。我还在 template.json 中尝试过使用以下架构,但这也不起作用。

"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"

奇怪的是,管道创建了我想要的资源组,但是我无法理解部署失败的原因。为了获取更详细的信息,我查看了门户中的“部署”菜单,以下是扩展错误

{
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details": [
{
"message": "No HTTP resource was found that matches the request URI 'https://management.azure.com/subscriptions/xx4873gx-4yy1-4092-9a70-34812353vv77/resourcegroups/test-rg-001/providers/Microsoft.Resources/resourceGroups/test-rg-001?api-version=2020-06-01'."
}
]
}

使用 ARM 模板,我只想创建资源组,不想包含任何其他资源的部署。有人已经闻到了吗,这里的 cooking 出了什么问题吗? :D

最佳答案

您看到上述错误是因为您尝试在管道中的资源组内创建资源组。

在管道中使用上述任务 AzureResourceGroupDeployment 配置。您正在资源组 test-rg-001 内创建一个资源组(即 test-rg-001)。如果没有找到您在 resourceGroupName 参数中指定的资源组(即 test-rg-001),它将自动创建一个资源组。这就是为什么您看到资源组 test-rg-001 被奇怪地创建的原因。看这个similar issue .

您可以使用任务 AzureResourceManagerTemplateDeployment部署范围设置为订阅而不是资源组。见下文:

steps:
- task: AzureResourceManagerTemplateDeployment@3
displayName: 'ARM Template deployment: Subscription scope'
inputs:
deploymentScope: Subscription
azureResourceManagerConnection: 'my-servicePrinciple (SPN)'
location: 'West Europe'
csmFile: $(Pipeline.Workspace)/arm_templates/ResourceGroup/template.json
csmParametersFile: $(Pipeline.Workspace)/arm_templates/ResourceGroup/parameter.json
deploymentMode: Incremental

关于Azure - 未找到与请求 URI 匹配的 HTTP 资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66754737/

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