I've set up use of the Send an HTTP request to Azure DevOps action that seems to always return Unauthorized. I know I've setup Azure DevOps authentication correctly because I'm also using the Azure DevOps Create a work item action and it works fine.
The unauthorized message gives me an object id of the user that is unauthorized, which is not me and does not seem to line up with any other Azure AD user we have. Could it be defaulting to a system user? Should it be working this way when it is using the same Data Connection as the Create a work item action?
Note: I tested the same Azure DevOps call through Postman and it worked correctly. So, I know for sure that I am authorized to access the api.
Hi @bkelley ,
Since the error message contains Unauthorized and the user mentioned in the message pointed to by Object id is not you.
Please try to update or reconfigure the connection of Send an HTTP request to Azure DevOps action to fix an authentication error.
In addition, you could consider clearing the credentials of Azure DevOps login in the browser.
When I test it on my side, I find that when I update the connection, it will automatically create a connection according to the credentials saved in the browser, and we cannot specify the connection name. So the account that currently creates the connection is not clear.
Hope it helps.
Thanks for the suggestions, @v-bacao-msft. I gave them a shot and once I set my Internet Options to have a Security Zone of "Prompt for Username and Password" instead of "Automatic Logon only in Intranet Zone", I was able to delete my Azure DevOps connection and switch accounts. I didn't see if it was connected to a different account, but rather just made sure I'm using the right one now.
I also cleared cache several times just to be certain. But alas, I am still getting the same Unauthorized error for the same user.
It is probably worth noting that we recently switched to Azure DevOps from an on-prem Team Foundation Server setup. So, I had an old login for MSDN that is separate from my current O365 credentials. I have associated them now. I'm just curious if it is somehow still pulling the old credentials instead of the new. I'm not sure how I would check that.
Hi @bkelley ,
The point you mentioned may be the reason why Unauthorized is always displayed.
Basically, as long as the current username and password can be used to log in to Azure DevOps on the browser, then a connection can be created.
You could try using a different browser to configure a similar Flow, delete the existing connection and use the new connection.
However, as far as I know, the current Azure DevOps connector supported by MS Flow seems to be Online Service, not On-premise data source. I am curious whether you can create a connection with Azure DevOps from an On-premise Team Foundation Server.
I tried using a different browser in in-cognito mode to have it force me to login. I was able to switch accounts and try the old msdn one I had. That one did not work either. So, I was able then to switch back to my current account.
To update the connection I just went to Connections and did a Switch Account on the Azure DevOps connection. That did the trick in toggling it between the users.
As far as on-premise goes, we've switched over to Azure DevOps, so I shouldn't need to connect that way anymore. But, I'll admit I don't fully understand the account switch between the two.
The more I think about this issue, I feel that it is something specific with the Send an HTTP Request to Azure action. Both this action and the Create a work item action use the same Azure DevOps connection and it correctly is able to create a work item with my account. So, either the HTTP action is somehow fudging the authentication or my user account is able to create an item but not query an item. Plus, I was able to query the item from postman, so it seems it should be able to do both.
Is there any way to troubleshoot this further? Is there any Setting I may have to change for that HTTP action?
Thanks again for your response.
Any update on this issue?
I face the same problem:
I'm experiencing this as well, exactly as described in the opening post. The step for creating a work item works, but the HTTP request step gets an unauthorized error.
Came back to this for a different project and got it to work...not sure if there was any changes to the connector or it was just my own stupidity. I had to make sure to insert the entirety of the URI, and I think I was using escape characters for spaces before (so I left actual spaces in my Team name):