简体   繁体   English

如何在 Azure DevOps 管道中引用 GitHub 中托管的 ARM 模板?

[英]How to reference an ARM Template hosted in GitHub in an Azure DevOps Pipeline?

I have this simple pipeline that migrates my DataFactory code from one lane to another patterned after Microsoft's recommendations .我有这个简单的管道,可以按照Microsoft 的建议将我的 DataFactory 代码从一个通道迁移到另一个通道。 Here it is:这里是:

steps:
- task: AzureResourceManagerTemplateDeployment@3
  inputs:
    deploymentScope: 'Resource Group'
    azureResourceManagerConnection: '{connectionName}'
    subscriptionId: '{subscriptionId}'
    action: 'Create Or Update Resource Group'
    resourceGroupName: 'default-rg'
    location: 'East US'
    templateLocation: 'URL of the file'
    csmFileLink: 'https://raw.githubusercontent.com/{OrgName}/{RepoName}/adf_publish/{folder}/ARMTemplateForFactory.json?token=GHSAT0AAAAAA*************************'
    csmParametersFileLink: 'https://raw.githubusercontent.com/{OrgName}/{RepoName}/adf_publish/{folder}/ARMTemplateParametersForFactory.json?token=GHSAT0AAAAAA*************************'
    overrideParameters: '-factoryName "{new factory name}"'
    deploymentMode: 'Incremental'

This code succeeds, but on line 10 I had to specify "URL of the file" and in line 12 and 13, I provide the raw url including a token parameter to allow access.此代码成功,但在第 10 行我必须指定“文件的 URL”,在第 12 和 13 行,我提供原始 url,包括允许访问的令牌参数。 I would like to instead link my GitHub repo and point to the files there.我想改为链接我的 GitHub 存储库并指向那里的文件。 I can't figure out how to do so.我不知道该怎么做。 Can anyone help?谁能帮忙?

Here is where I am so far.这是我到目前为止的位置。 I added 1-7 to reference the GitHub repo where the files live.我添加了 1-7 以引用文件所在的 GitHub 存储库。 They exist on the "adf_publish" branch.它们存在于“adf_publish”分支上。 Line 18 I changed to the "Linked Artifact".第18行我改成了“连环神器”。 Line 19 and 20 is where I want to reference my files, but not sure what the syntax should be.第 19 行和第 20 行是我想引用我的文件的地方,但不确定语法应该是什么。

resources:
  repositories:
  - repository: {RepoName}
    type: github
    name: {OrgName}/{RepoName}
    endpoint: {ServiceConnectionName}
    ref: adf_publish

steps:
- task: AzureResourceManagerTemplateDeployment@3
  inputs:
    deploymentScope: 'Resource Group'
    azureResourceManagerConnection: '{ConnectionName}'
    subscriptionId: '{subscriptionId}'
    action: 'Create Or Update Resource Group'
    resourceGroupName: 'default-rg'
    location: 'East US'
    templateLocation: 'Linked artifact'
    csmFile: '??'
    csmParametersFile: '??'
    overrideParameters: '-factoryName "{new factory name}"'
    deploymentMode: 'Incremental'

I got it to work using this code:我使用这段代码让它工作:

resources:
  repositories:
  - repository: adf_publish
    type: github
    name: {OrgName}/{RepoName}
    endpoint: {ServiceConnectionName}
    ref: adf_publish
steps:
- checkout: self
  path: main
- checkout: adf_publish
  path: adf
- task: AzureResourceManagerTemplateDeployment@3
  inputs:
    deploymentScope: 'Resource Group'
    azureResourceManagerConnection: {ConnectionName}
    subscriptionId: '{subscriptionId}'
    action: 'Create Or Update Resource Group'
    resourceGroupName: 'default-rg'
    location: 'East US'
    templateLocation: 'Linked artifact'
    csmFile: '$(Agent.BuildDirectory)/adf/{data factory name}/ARMTemplateForFactory.json'
    csmParametersFile: '$(Agent.BuildDirectory)/adf/{data factory name}/ARMTemplateParametersForFactory.json'
    overrideParameters: '-factoryName "{new factory name}"'
    deploymentMode: 'Incremental'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure DevOps 管道 - 如何通过自托管代理在 docker 容器中执行整个模板阶段 - Azure DevOps pipelines - how to execute a whole template stage in a docker container by a self-hosted agent Azure Devops 管道,知道管道何时完成的方法,使用自托管代理 - Azure Devops pipeline , way to know when pipeline is done , using self hosted agent 如何将 ACR 与 Azure devops 管道连接,以便每当 ACR azure devops 管道中有新图像时触发 - How to connect ACR with Azure devops pipeline such that whenever there is a new image in ACR azure devops pipeline trigger Azure 管道发布管道:ARM 模板部署:资源组 scope 失败,错误代码:部署失败” - Azure pipeline Release pipeline: ARM Template deployment: Resource Group scope fails with ,,Error code: DeploymentFailed" 如何根据提交消息触发 azure devops build pipeline? - How to trigger azure devops build pipeline based on the commit message? 如何使用 jquery 触发 Azure Devops 发布管道 - How to trigger Azure Devops release pipeline using jquery Azure 插件的 devops 管道条件 - Azure devops pipeline condition of plugin Azure DevOps 发布管道中的 Bicep - Azure Bicep in DevOps release pipeline 如何从yaml管道访问Azure Devops API? - How to access Azure Devops API from yaml pipeline? 将 GitHub 存储库同步到 Azure DevOps - Sync GitHub Repositories into Azure DevOps
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM