[英]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.