web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Send an HTTP request t...
Power Automate
Suggested Answer

Send an HTTP request to Azure DevOps 'Unauthorized' Error

(0) ShareShare
ReportReport
Posted on by
Hi,
 
I need help with a flow I created. In this http request step,
 
 
 
I keep getting this error when I run the  I have admin access to the devops, so I don't know why it keeps saying I don't have access. Please help.
Categories:
I have the same question (0)
  • Suggested answer
    Ninjasabi Profile Picture
    122 on at

    If you have admin access to Azure DevOps and still encounter the 'Unauthorized' error, the issue might be with the request configuration, credentials, or endpoint. Here's how you can debug the issue effectively using a Compose step and isolate the problem:


    Step-by-Step Solution with Debugging

    1. Add a Compose Step for Debugging

    To identify the root cause, inspect the inputs and outputs of your HTTP request.

    1. Before the HTTP Request:

      • Add a Compose action to verify the URL, headers, and body:
        • Input: Paste the API URL you’re using and any dynamic fields.
        • Example:
          https://dev.azure.com/{OrganizationName}/{ProjectName}/_apis/wit/workitems?api-version=7.1-preview.3
      • Add a second Compose step for headers and verify:
        • Authorization: Check if the header is correct and contains a valid Personal Access Token (PAT).
          Example:
          Authorization: Basic {Base64EncodedPAT}
    2. After the HTTP Request:

      • Add another Compose action to capture the response from the HTTP request, even if it fails:
        • Input: outputs('Send_an_HTTP_request_to_Azure_DevOps')?['body']
      • This helps you inspect the error message returned by Azure DevOps.

    2. Validate the HTTP Request Setup

    • API Endpoint: Ensure the URL is correct.

      • Example for listing work items:
        https://dev.azure.com/{OrganizationName}/{ProjectName}/_apis/wit/workitems?api-version=7.1-preview.3
    • Headers:

      • Check that the Authorization header is correct:
        Authorization: Basic {Base64EncodedPAT}
        Content-Type: application/json
    • PAT (Personal Access Token):

      • If you're using admin access, generate a PAT with the required scopes:
        1. Go to Azure DevOps > User Settings > Personal Access Tokens.
        2. Create a PAT with Full Access or at least the required scopes (Work Items, Build, etc.).
        3. Base64 encode the PAT with a placeholder username (user:PAT) and include it in the Authorization header.

    3. Add a Condition to Check Admin Access

    Even with admin rights, the issue might relate to API-level permissions or endpoint misconfiguration. Use a condition to log access checks:

    1. Add a Compose action before the HTTP request:

      • Input: "Attempting HTTP request with URL: {Your_API_URL}"
    2. Add a Condition to verify access:

      • Use a GET request to a basic endpoint to verify permissions:
        • Endpoint:
          https://dev.azure.com/{OrganizationName}/_apis/projects?api-version=7.1-preview.3
      • If this fails, the issue is likely with authentication.

    4. Check for Common Issues

    • Organization and Project Name: Ensure they are correct in the API URL.
    • API Version: Use the latest version (e.g., 7.1-preview.3).
    • Firewall or Network Restrictions: Ensure Power Automate can reach Azure DevOps.

    Debugging Steps Recap

    1. Compose for URL, Headers, and Body: Log the API URL, headers, and payload.
    2. Inspect Response Body: Use a Compose step to output the HTTP response body, even on failure.
    3. Check Authorization Header: Ensure the PAT is properly Base64-encoded.
    4. Condition to Test Access: Use a simple API endpoint to confirm credentials and connectivity.

    Next Steps

    After running the flow:

    1. Check the outputs of the Compose steps to identify if the issue is with the API URL, headers, or token.
    2. Share the exact error message for further troubleshooting, if needed.

    Let me know if you need help implementing or interpreting these steps!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard