简体   繁体   English

Azure CLI 管道任务挂在 ADO 上

[英]Azure CLI pipeline task hanging on ADO

I've written a simple AzureCLI script which should update a variable group value for a project.我编写了一个简单的 AzureCLI 脚本,它应该更新项目的变量组值。 I've tested the script locally and this workds find so I know its an ADO issue, this script is:我已经在本地测试了脚本,并且发现了这个脚本,所以我知道它是一个 ADO 问题,这个脚本是:

echo $Pat_key| az devops login
az devops configure -d organization=https://dev.azure.com/****/ project=***
            
az pipelines variable-group variable update --id 365 --name release.version --value **-Release-1.2.0
     

I've tried a few differnt flavours, either running in powershell or adding the PAT token manually or not at all and either get AzureCLI just hanging and not progressing the task.我尝试了几种不同的风格,要么在 powershell 中运行,要么手动添加 PAT 令牌,或者根本不添加,要么让 AzureCLI 挂起而不继续执行任务。 If I get an error message, this is what I get:如果我收到一条错误消息,这就是我得到的:

ERROR: TF400813: The user 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' is not authorized to access this resource.

Any help would be amazing.任何帮助都会很棒。 Thanks again!再次感谢!

The user 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' is not authorized to access this resource.用户 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' 无权访问此资源。

The error shows that the user accessing the resources with anonymous access.该错误表明用户以匿名访问方式访问资源。

I hope you are logged in with az devops login only once when running the pipeline.我希望您在运行管道时仅使用az devops login一次。 If not avoid multiple logins.如果不能避免多次登录。

echo $Pat_key| az devops login

Steps to fix the issue:解决问题的步骤:

  1. while running the pipeline you are getting the User is not authorized to access this resource error make sure it has a valid resource access.在运行管道时,您将获得用户无权访问此资源错误,请确保它具有有效的资源访问权限。 If the user has access to the resources, please make sure to clear the cache before running the script.如果用户有权访问资源,请确保在运行脚本之前清除缓存。 (The organization is connected to AAD, and the user has part of the AAD) (组织连接AAD,用户拥有部分AAD)
  2. Reset the PAT token resolve the issue.重置PAT令牌可解决问题。

Having the same issue since last couple of weeks:/ Locally this works, it doesn't work only via azure pipelines.自过去几周以来遇到同样的问题:/在本地这有效,它不仅通过 azure 管道有效。 So I can tell its not a permission issue nor I don't have to reset my PAT.所以我可以说这不是权限问题,也不必重置我的 PAT。

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

相关问题 Azure Devops 管道任务 (Azure CLI@2) 失败 - Azure Devops Pipeline task (Azure CLI@2) failing 在发布管道中使用 Azure CLI 任务中的秘密变量 - Using secret variable in Azure CLI task in release pipeline 带有 acr 清除的 Azure 管道 CLI 任务失败 - Azure pipeline CLI task with acr purge getting failed 在 Azure Devops 中,如何在运行 shell 脚本的“Azure CLI task v.2”中使用管道变量? - In Azure Devops, how can i use pipeline variables in a “Azure CLI task v.2” running shell script? 如何在 Azure 管道的 azure cli 任务中的 Get-Date 中添加 10 小时? - How to add 10 hrs in the Get-Date in azure cli task for Azure pipeline? Azure Devops:在 Devops 管道任务中通过 Azure CLI 进行模型注册和打包 - Azure Devops: Model Register and package through Azure CLI in Devops pipeline Task Azure DevOps 发布管道 Azure CLI Powershell 任务找不到 Z2F2D399F0EA80FE47B3459 - Azure DevOps Release pipeline Azure CLI Powershell task can't find powershell 在Jenkins管道中使用Azure CLI - Using Azure CLI in Jenkins pipeline Azure Powershell代理任务管道 - Azure Powershell agent task pipeline 在失败的任务上继续执行Azure Pipeline - Continue Azure Pipeline on failed task
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM