我正在尝试使用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
错误表明找不到在参数csmFile中指定的azuredeploy.json文件。
[当Azure代理构建您的管道时,回购源代码被克隆到代理计算机上的默认工作文件夹($(System.DefaultWorkingDirectory)
,即c:\agent_work\1\s
)中。如果您的回购如下所示:
然后文件夹结构类似于代理计算机中的以下结构。
s |
- Deploymentfiles
|
- StorageAccount
|
- **.json
- VirtualNetwork
|
...
- readme.md
并且csmFile的路径应为csmFile: 'Deploymentfiles\StorageAccount\azuredeploy.json'
但是,如果不确定文件夹的结构,也可以像下面的示例一样使用通配符。
csmFile: '**\azuredeploy.json'
csmFile: '$(System.DefaultWorkingDirectory)\**\azuredeploy.json'