Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to fix "failed to authorize: failed to fetch oauth token: unauthorized" issue
#1
[ERROR] failed to authorize: failed to fetch oauth token: unauthorized (Azure DevOps Pipeline)

Screenshot:
https://prnt.sc/NjRe-qyltGbV


---------------------------------------
ROOT CAUSE:
---------------------------------------
The issue is caused due to an invalid or expired Docker Registry Service Connection (OAuth token) in the Azure DevOps pipeline.


---------------------------------------
RESOLUTION STEPS:
---------------------------------------

1. Login to Azure DevOps:

https://dev.azure.com/

2. Navigate to the failed pipeline.

3. Click on the branch name

  Example: master_preprod
  Screenshot: https://prnt.sc/aG5XZoRORMpY

4. It will open the repository files.

5. Rename the existing pipeline file:

azure-pipelines-preprod.yml → azure-pipelines-preprod.yml-bak

6. Go back to "Repos" → Click on "Setup Build"

7. Configure new pipeline:

  - Select Subscription: Sadad Azure
  - Select Repository: Sadaddevrepo
  - Click "Create Pipeline"

8. A new pipeline YAML file will be created automatically.

9. From the newly created pipeline file, copy the following field:

  Example:
  dockerRegistryServiceConnection: 'bc53aa1f-3499-4d92-ab29-7df77c562ada'

10. Paste this value into your original (renamed) pipeline YAML file.

11. Rename the pipeline file back to original:

    azure-pipelines-preprod.yml-bak → azure-pipelines-preprod.yml

12. Commit the changes.

13. This will trigger the pipeline again.

14. Monitor the build progress and verify.


---------------------------------------
NOTES:
---------------------------------------
- This issue typically occurs when the service connection token expires or becomes invalid.
- Recreating the pipeline helps regenerate a valid service connection reference.


---------------------------------------
STATUS:
---------------------------------------
After updating the service connection, the pipeline should run successfully.

Let me know if anyone still faces the issue ?
Reply


Messages In This Thread
How to fix "failed to authorize: failed to fetch oauth token: unauthorized" issue - by rishi - 04-07-2026, 10:50 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)