使用Azure DevOps部署ARM:找不到与模板文件模式匹配的任何文件

问题描述 投票:0回答:1

我正在尝试使用Azure DevOps部署ARM。Git仓库的路径是“ ARMTemplates \ CreateSQLServerARM \ azuredeploy.json”但是我遇到了错误。有什么问题吗?

错误:

 Checking if the following resource group exists: KensTestRG.
 Resource group exists: true.
 Creating deployment parameters.
 ##[error]Error: Could not find any file matching the template file pattern
 Finishing: AzureResourceGroupDeployment

代码:#入门管道

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

steps:
-     task: AzureResourceGroupDeployment@2
  inputs:
    deploymentScope: 'Resource Group'
    ConnectedServiceName: 'AzureRmPipeline-conn'
    subscriptionId: '1111753a-501e-4e46-9aff-6120ed562222'
    action: 'Create Or Update Resource Group'
    resourceGroupName: 'KensTestRG'
    location: 'North Europe'
    templateLocation: 'Linked artifact'
    csmFile: 'ARMTemplates\CreateSQLServerARM\azuredeploy.json'
    deploymentMode: 'Incremental'
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
  • 脚本:| |echo添加其他任务以构建,测试和部署项目。回声请参见https://aka.ms/yamldisplayName:'运行多行脚本'
azure-devops azure-resource-manager
1个回答
0
投票

错误表明找不到在参数csmFile中指定的azuredeploy.json文件。

[当Azure代理构建您的管道时,回购源代码被克隆到代理计算机上的默认工作文件夹($(System.DefaultWorkingDirectory),即c:\agent_work\1\s)中。如果您的回购如下所示:

enter image description here

然后文件夹结构类似于代理计算机中的以下结构。

s |
   - Deploymentfiles
     |
     - StorageAccount 
       |
       - **.json
   - VirtualNetwork
     |
      ...
   - readme.md

并且csmFile的路径应为csmFile: 'Deploymentfiles\StorageAccount\azuredeploy.json'

但是,如果不确定文件夹的结构,也可以像下面的示例一样使用通配符。

csmFile: '**\azuredeploy.json'

csmFile: '$(System.DefaultWorkingDirectory)\**\azuredeploy.json'

© www.soinside.com 2019 - 2024. All rights reserved.