Tuesday, March 27, 2018

How to call Azure WebJob API using the AAD OAuth?

I have a MVC application that use Azure AAD OAuth authorization. I want to call Azure WebJob API using the OAuth token. I found following example but the issue is where to get the right resource name for the call of Azure WebJob API?

I can get the token by following code:

AuthenticationResult result = authContext.AcquireToken("https://graph.windows.net", credential); 

But it returns Forbidden when the token is used to call the WebJob REST API (like GET https://<name>.scm.azurewebsites.net/api/webjobs) later. Note it works from web browser.

I have already tried to use "https://management.azure.com/" or "https://<name>.azurewebsites.net/" as the resource name but none of them works. The documentation is terrrible.

Thanks.

How to call Azure WebJob API using the AAD OAuth? Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team