Others

Fix Azure DevOps HTTP 401 Authorization Errors in Logic Apps

Khadija KhanKhadija Khan Oct 14, 2026 869 views

Question details

The user is experiencing an HTTP 401 (TF400813) authorization error when making requests to Azure DevOps from Logic Apps or Power Automate, despite the same requests succeeding in Postman.

How to Fix Azure DevOps HTTP 401 Authorization Errors in Logic Apps
Product
Logic Apps / Azure DevOps
Device & OS
not provided
Scenario
Automating Azure DevOps tasks via HTTP requests using Logic Apps or Power Automate.
Observed behavior
The HTTP request returns a 401 Unauthorized status with a TF400813 error, indicating the authenticated user or Personal Access Token lacks access.
Before you start

Ensure you have active access to your Azure DevOps organization and possess the necessary administrative rights to generate and manage Personal Access Tokens (PAT).

Solution 1Recommended

Verify and Base64-Encode Your Personal Access Token (PAT)

Check if your PAT has expired, lacks required scopes, or is incorrectly encoded for the Logic Apps HTTP action.

Logic Apps and Power Automate HTTP actions require the Authorization header to be properly Base64-encoded when using Basic Authentication. A common mistake is using the raw PAT, which works in Postman's built-in auth tab but fails in automated flows.

1
Generate a new PAT

Log into Azure DevOps, click on 'User settings' (the gear icon) at the top right, select 'Personal access tokens', and click 'New Token'. Ensure you grant it the specific scopes required for the API you are calling.

2
Format the token string

Create a string that combines an empty username and your new PAT, separated by a colon. It should look like this: ':{Your_PAT}'.

3
Base64 encode the string

Use an online tool or a local script to Base64-encode the ':{Your_PAT}' string. Alternatively, you can use the expression 'base64()' directly inside the Logic App designer.

4
Update the Logic App HTTP action

Open your Logic App designer, navigate to the HTTP action, and add a header named 'Authorization'. Set its value to 'Basic {Your_Base64_Encoded_String}'.

Verify and Base64-Encode Your Personal Access Token (PAT)
Encoding Tip: If you are using the Logic Apps expression builder, the exact formula is: base64(concat(':', variables('YourPATVariable'))).
Free Microsoft Office alternative

Manage Your API Documentation with WPS Office

While you troubleshoot complex Azure DevOps integrations and Logic Apps workflows, ensure your daily project documentation remains accessible and organized. WPS Office is a free, lightweight, and user-friendly alternative to Microsoft Office, ideal for maintaining your technical specs and error logs.

  1. 1. Visit the official site: Go to the official WPS Office website to find the latest free version.
  2. 2. Download the software: Click the download button corresponding to your operating system (Windows, Mac, or Linux).
  3. 3. Install and launch: Run the downloaded installer and open WPS Office to start managing your project files immediately.
Seamlessly compatible with Microsoft Word, Excel, and PowerPoint formats (.docx, .xlsx, .pptx).Free and incredibly lightweight, consuming minimal system resources on your workstation.Familiar tabbed user interface, allowing you to edit documents, spreadsheets, and PDFs in a single window.Built-in robust PDF editing tools for creating and sharing technical documentation securely.
QA img-9

Frequently Asked Questions

Why does my Azure DevOps API request work in Postman but fail in Logic Apps?

Postman handles authorization headers dynamically when you use its built-in Authorization tab, automatically encoding your token. In Logic Apps, if you manually construct an HTTP request, you must ensure your Personal Access Token (PAT) is explicitly Base64-encoded with a leading colon (:{PAT}).

What does the TF400813 error mean in Azure DevOps?

The TF400813 error is a specific authorization error indicating that the authenticated user or token is not authorized to access the requested resource. This typically occurs when a Personal Access Token is expired, invalid, improperly formatted, or lacks the necessary scopes for the API endpoint.

How do I securely Base64 encode my Personal Access Token for Power Automate?

You can use the built-in expression builder in Power Automate or Logic Apps. Combine an empty username and your PAT with a colon using the 'concat()' function, then wrap it in the 'base64()' function. For example: base64(concat(':', 'YourPATString')).