Fix Azure DevOps HTTP 401 Authorization Errors in Logic Apps
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.

- 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.
Ensure you have active access to your Azure DevOps organization and possess the necessary administrative rights to generate and manage Personal Access Tokens (PAT).
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.
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.
Create a string that combines an empty username and your new PAT, separated by a colon. It should look like this: ':{Your_PAT}'.
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.
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}'.

Check Azure DevOps Account and Project Permissions
Ensure the identity associated with the token actually has permission to view or modify the specific Azure DevOps project.
Escalate to Azure Support
If your token is valid, encoded correctly, and permissions are verified but the 401 error persists, escalate the issue to Azure Support.
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. Visit the official site: Go to the official WPS Office website to find the latest free version.
- 2. Download the software: Click the download button corresponding to your operating system (Windows, Mac, or Linux).
- 3. Install and launch: Run the downloaded installer and open WPS Office to start managing your project files immediately.

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




