I have an url from one of my azure app website. What I want to do is to do a Web request on this url by using token.
I managed to retrieve the token $token with the same method as here. And the folowing command worked fine
Invoke-WebRequest "https://graph.microsoft.com/v1.0/me" -Headers @{Authorization="Bearer $token"}
Then I tried
Invoke-RestMethod -Uri "myurl" -Headers @{"authorization" = "Bearer $token"}
But I got the folowing issue :
Invoke-WebRequest : {"code":401,"message":"IDX10511: Signature validation failed. Keys tried: '[PII is hidden]'. \u000akid: '[PII is hidden]'. \u000aExceptions caught:\u000a
'[PII is hidden]'.\u000atoken: '[PII is hidden]'."}
So it seems that the signature is not valid. Any Idea why and how to fix it ? Thanks