I was asked to refactor an AWS Lambda (using Python) which calls an Azure Logic App.
When I run my Lambda, it gets a 202 (accepted) response. In Azure, I can see the request failed with the following error:
{"error": {"code": "AuthenticationFailed","message": "Authentication failed. The 'Authorization' header is missing." }}
As the error says, an authorization header is missing. Odd thing is, the previous code base which was working until recently, doesn't appear to provide any authorization header either.
Here's my code:
import requestsimport jsonurl = "https://prod-01.northcentralus.logic.azure.com:443/workflows/sensitive/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Frun%2Fbook%2Fsp&sv=1.0&sig=sensitive"body = {"company": "X","owner": "bob@email.com"}requests.post(url, data=json.dumps(body), headers=headers)
The old lambda's code is essentially identical. When I copy+paste the relevant part into my lambda, I get the same error.
As I said, this was supposedly working fine until recently.
All of my reading online suggests that I need a bearer token generated using a service principal.
I've been trying to figure out how to piece this request together bit by bit using Postman. But the posts I've found online explaining how to do just this don't work when I try them. (When I try this post, it says I should get an Invalid Auth Key
response in Postman. But I just get the same 202 response.
And I noticed that one of the params encoded in the logic app's url is sp=%2Frun%2Fbook%2Fsp
or sp=run/book/sp. Is this somehow related to the service principal? I don't have access to Azure Active Directory to check it out.
Thanks much!