简体   繁体   中英

Azure CLI pipeline task hanging on ADO

I've written a simple AzureCLI script which should update a variable group value for a project. I've tested the script locally and this workds find so I know its an ADO issue, this script is:

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. 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.

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. 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)
  2. Reset the PAT token resolve the issue.

Having the same issue since last couple of weeks:/ Locally this works, it doesn't work only via azure pipelines. So I can tell its not a permission issue nor I don't have to reset my PAT.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM