locked
Authenticate to a web service behind Azure application proxy and AD from code RRS feed

  • Question

  • Hi, I installed and configured application proxy connector for my wcf service with REST endpoint. It works fine with Passthrough authentication (web service is configured with Anonymous authentication in our IIS). When we go live we will need to turn on Azure AD authentication. It works fine with web browser, but I can't make it work from a console app.

    I used the following example to test Azure AD authentication. It is working fine, but it is an Azure application service, not an app proxy. I get my access token in the same way but when I try to contact my web service via app proxy with Authorization header, I get redirected to a Microsoft logon page. I get a response as http 200, html text. I am using HttpClient, tried WebClient and HttpWebRequest, no difference. Html I get contains some scripts, that is why it is working from web browser, it runs the scripts which do their thing and get me to my service.

    Is there a way to get to the service via code? Appreciate any help, thanks in advance.

    Friday, June 8, 2018 1:34 PM

Answers

  • It was wrong to get the redirect at first place, it is working now for another web service. I have no idea why it didn't work for my simple wcf service, but I suspect something with DNS on local server. I will not spend more time on it anyway.
    • Marked as answer by Radevic Wednesday, June 13, 2018 11:58 AM
    Wednesday, June 13, 2018 11:58 AM

All replies

  • It was wrong to get the redirect at first place, it is working now for another web service. I have no idea why it didn't work for my simple wcf service, but I suspect something with DNS on local server. I will not spend more time on it anyway.
    • Marked as answer by Radevic Wednesday, June 13, 2018 11:58 AM
    Wednesday, June 13, 2018 11:58 AM
  • Glad to know your issue got resolved, do let us know if you need any further assistance.
    Saturday, June 16, 2018 6:21 PM