-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure Application Proxy access using MSAL token #2178
Comments
@Mir4ik maybe you need an accept default header to get Json? |
@jmprieur adding JSON accept header do not help, same issue |
.net classic or .net core? |
Try var httpClient = new HttpClient(new HttpClientHandler() {
UseDefaultCredentials = true }); |
@bgavrilMS no changes - https://imgur.com/YNL2NkC |
In your picture it seems the Http call returns a 200 OK? |
It redirects to login.microsoft.com asking to log in and login.microsoft.com returns 200, sample URL with parameters in initial post. |
Got it. I'm afraid I don't know what's going on. If access token is invalid, protected APIs return 401, they should not redirect. We are not familiar enough with App Proxy to diagnose these issues. MSAL's responsability ends when a token is obtained. I recommend you open a support ticket instead from Azure Portal (they are free as far as I know). |
i have not been able to successfully connect to azure sql using msal as used above or with any of the examples using .Net 5 with WPF. I can use keyvault no problem to credential. but once i go through the msal process and try the different non-embedded views, and redirectURI recommendations, I still end up with code that never receives a response. The exact same approach works fine in the .net framework with nearly all the same libraries. let me know if you have any insights rather than waiting for better .net core integration. |
@j5aenz - I think this is a different problem. OP is getting a token, but the token is not valid. In your case, you're not getting a token. We plan to release a .NET 5 version that has both system webview (the one with http://localhost) and an embedded webview, see #1398 |
Hello, Any update on this issue please? |
@pranayubs , please correct me if i am wrong @bgavrilMS , but i am patiently waiting for Microsoft.Identity.Client 4.25.0 to solve this issue or implement WAM and potentially circumvent the issue. i have tried a number of different combinations of settings in Azure without success in 4.24.0. And it looks like #1398 refers to this but kind of circularly refers back to this thread. |
@Mir4ik Was this issue ever resolved or did you find a workaround? I'm facing the same issue. I can authenticate successfully, but when I try to access an Application Proxy endpoint I'm encountering the sign-in page. |
Are you using ASP.NET Core, @chuckconway ? |
I am. That's very cool, I didn't know about that feature. But I'm not seeing how this feature will help with the Azure Application Proxy access issue... |
I think that this is a problem of with headers, and that article, and in particular the forward headers, should help you. If you are using ASP.NET Core we also suggest you use Microsoft.Identity.Web: https://github.com/AzureAD/microsoft-identity-web/wiki/1.0.0 |
I miss read your question about ASP.Net Core. For some reason, I thought you were just asking about .Net Core vs .Net. I'm not using ASP.Net Core, just .Net Core. The problem I'm having is the same as the opener of this thread. I can get the JWT Token for the user from AAD, but when I make a request to an Azure Application Proxy endpoint I'm routed to the sigin-in page. I'm following this MS Documentation: https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/application-proxy-secure-api-access#:%7E:text=Secure%20access%20to%20on-premises%20APIs%20with%20Azure%20AD,...%205%20Configure%20the%20native%20app%20code.%20 Here is the code:
Accessing the endpoints via the browser works perfectly, but via code/JWT it does not work. I'm hoping someone has overcome this problem either in code or a workaround. |
@jmprieur Thank you for pointing that out! I made the change, but I'm still receiving the sign-in page :( |
@chuckconway, have you found any solution to this? Thanks |
I did, I opened up a ticket with Microsoft and they helped me.
I updated my answer on Stackoverflow: https://stackoverflow.com/questions/66975070/accessing-on-premise-api-through-azure-proxy-with-azure-directory-enabled
I hope that helps.
— Chuck
…On Nov 1, 2021, 2:53 AM -0700, Nasir ***@***.***>, wrote:
@chuckconway, have you found any solution to this? Thanks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@chuckconway, thank you for providing this information. I kind of have a similar situation, can you please check: https://github.com/MicrosoftDocs/azure-docs/issues/83207, and see if you can be of help? Thanks |
Unfortunately, the MS ticket solved my issue. My work was a POC so I didn’t progress any further.
— Chuck
…On Nov 1, 2021, 4:05 AM -0700, Nasir ***@***.***>, wrote:
@chuckconway, thank you for providing this information. I kind of have a similar situation, can you please check: MicrosoftDocs/azure-docs#83207, and see if you can be of help? Thanks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Recommendation is to use WAM on public client, see https://aka.ms/msal-net-wam |
Implemented test windows application based on official manual: https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/application-proxy-configure-native-client-application
Following code is a result:
Everything works fine until HTTP request with a token, it is being redirected to login.microsoft.com: https://i.stack.imgur.com/GUe7l.png
Redirect URI to login.microsoft.com: {https://login.microsoftonline.com/9966XXXXXXXXXXXXXXXXXXXXXXXX/oauth2/authorize?response_type=code&client_id=XXXXXXXXXXXX&scope=openid&nonce=983XXXXXXXXXXXXXX&redirect_uri=https:%2f%2fXXXXXXX.msappproxy.net%2f&state=AppProxyState:{"InvalidTokenRetry":true%2c"IsMsofba":false%2c"OriginalRawUrl":"https:%5c%2f%5c%2fXXXXXXXXXXXXXXX.msappproxy.net%5c%2fapi%5c%2fvalues"%2c"RequestProfileId":"XXXXXXXXX"}%23EndOfStateParam%23&client-request-id=XXXXXXXX}
Any ideas what's wrong? Browser access works just fine, also JWT token is fully valid and being passed correctly.
The text was updated successfully, but these errors were encountered: