-
Notifications
You must be signed in to change notification settings - Fork 300
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
native aot deployment error using Microsoft Entra authentication with Azure SQL #2742
Comments
Thank you for reporting this issue. We tried to reproduce the issue by creating test application using the template ASP.NET Core WebAPI (native AOT). We then tried to add connection string with Authentication=Active Directory Interactive. The test run succeeded. We then tried to publish using Could you provide an example reproduction code, please? This will help us to investigate this issue further. |
this an example you can use to reproduce the errorr , i just added small code to open a database connection , The web API works in development mode, but once deployed, it throws an error. in development mode when trying to connect to the server, a browser session opens to enter your credentials. However, after deployment, this process no longer works an throw an error Can you send me your example so I can review it? |
Thank you for the repro. I tried the provided repro and identified that the issue happens when using MDS version 5.2.1. A hotfix is scheduled to be release within the first 2 weeks of August. We'll let you know when it becomes available. |
any update ?? |
@guillermoright Can you verify the fix in MDS 5.2.2? |
@DavoudEshtehari The fix in version 5.2.2 does not resolve the issue; we are still encountering the same error when releasing the application using dotnet publish -r win-x64 -c Release. If you go to the publish folder (bin\Release\net8.0\win-x64\publish) and execute NativeApi.exe, it throws the same error reported earlier, but in development mode works well In the example application, you need to replace the values of "database name" and "database server" with real ones. then go to the browser /weatherforecast Microsoft.AspNetCore.Server.Kestrel[13] |
@guillermoright How are you publishing the application? Have you tried a Deployment Mode of Self Contained? Is there a reason why you would not deploy using Deployment mode Self Contained? |
@arellegue It is Native Aot , just like self-contained apps, using this instruccion "PublishAot true PublishAot" so when i run dotnet publish -r win-x64 -c Release , the app include all required runtime libraries |
@guillermoright I see that the issue was closed. Could you try to reference the MDS 6.0-preview1 to see if it fixes the issue, please? |
@arellegue The MDS 6.0-preview1 dosent solve the issue , it is imposible to connect to azure SQL Database HyperScale, for an application when it is released |
I resolved this issue a couple months ago with my ASP.NET backend by creating a custom auth provider implementation. The issue here is that To do that, you'll need a custom auth provider implementation, as there isn't a constructor available for overriding the internal memory cache yet. Copy the code from ActiveDirectoryAuthenticationProvider.cs, and adjust it as necessary, such as setting the tenant ID, etc. I don't have my custom provider source code on hand, as I'm not currently working at the company where I resolved this issue, but it's really easy to make the code work. Once you have your provider, add a constructor accepting a Then you'll create an instance of your provider before running your app. Use Now that you have your provider constructed, call I hope this helps. I might make an API proposal to add constructors accepting |
Native Aot
using native AOT with ASP.NET Core, minimal api, with azure sql server with Microsoft Entra authentication with Azure SQL,
this is the connection string for Microsoft Entra MFA Serve authentication:
{servername};Authentication=Active Directory Interactive;Database={databaseName}
when we deploy the aplication dotnet publish -r win-x64 -c Release, we are getting this error , seems the microsoft entra authentication is not supported,
The text was updated successfully, but these errors were encountered: