我如何获取(重新创建)AzureDevOps管道中使用的承载令牌?

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

我的Yaml基础结构即代码部署失败,但在第一步yaml上失败:

- task: ArchiveFiles@1
  displayName: 'Archive createADPDC.ps1 DSC files '
  inputs:
    rootFolder: 'Core/Templates/createADPDC.ps1'
    includeRootFolder: false
    replaceExistingArchive: true
    archiveFile: '$(Build.ArtifactStagingDirectory)/createADPDC.ps1.zip'

为了解决这一问题,我开始逐行尝试模拟托管管道服务器上正在执行的操作,并且陷入了承载令牌的困境。除非有更好的方法来诊断ArtifactStagingDirectory中为什么缺少文件,否则我将运行以下命令来检查正在下载的文件和结构。

git init "C:\a\1\s"
Initialized empty Git repository in C:/a/1/s/.git/
git remote add origin https://[email protected]/MyLabs/Core/_git/Core
git config gc.auto 0
git config --get-all http.https://[email protected]/MyLabs/Core/_git/Core.extraheader
git config --get-all http.proxy                                                                            
git -c http.extraheader="AUTHORIZATION: bearer ***" fetch --force --tags --prune --progress --no-recurse-submodules origin
fatal: Authentication failed for 'https://dev.azure.com/MyLabs/Core/_git/Core/'

问题

任何一个:

  1. 确定或理解为什么存档文件返回的更好方法是什么?>
  2. [error] ENOENT:没有这样的文件或目录,stat'D:\ a \ 1 \ s \ Core \ Templates \ createADPDC.ps1'

  1. 获取承载令牌(PAT)以在日志中的命令行中使用的正确方法是什么?>
  2. 我的yaml基础结构代码部署失败,但在第一步yaml失败:-任务:ArchiveFiles @ 1 displayName:'Archive createADPDC.ps1 DSC文件'输入:rootFolder:'...

]
azure-devops yaml azure-pipelines azure-automation dsc
2个回答
0
投票
  1. 您确定目录正确吗?
  2. 您可以使用$(system.accesstoken)以管道脚本访问PAT。确保在yml中的工作级别上启用了持久凭证

0
投票

因此,最好了解管道中使用的目录结构的句柄。

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