(Note: I tried, 6 times to post this question to Microsoft Q&A, but it refused to allow me to post it. So, I’m posting it here. I hope this is the correct place. I am still new to Dev.To, so if this is wrong, please forgive me and direct me to where I should post it.)
I’m working on an ASP.NET Blazor app I created using .NET 9 and the Blazor Web App template (I believe that’s the correct name; it’s been some months ago). It created a Blazor application with a server-side Blazor project and a Blazor WebAssembly project. To that Visual Studio I added a third project, which is a Minimal API project.
I’ve been having problems making the Minimal API project access an Azure Key Vault I created two years ago. In the key vault I added connection strings for our test and production databases in Secrets. I would much rather use Azure Key Vault because it is much more secure than using appsettings*.json files where the connection strings would be saved in plain text. However, I’ve been struggling with this for a few weeks, and my management wants to see some progress.
One of my colleagues has recommended that we drop Azure Key Vault entirely and just use connection string hard coded in the C# code. I don’t like this idea, but under the circumstances it might be necessary. Nevertheless, I did think of a couple of potential problems. One is the SQL Server database was configured years ago to only use SQL Authentication. Thus, the reason I wanted to store the connection string as securely as possible.
The second possible problem is an additional idea my colleague had, which is to use what we’ve used for years when writing ASP.NET MVC apps (and WPF/WinForms apps) and that is trusted connections. Certainly, that would eliminate storing database connection strings in source code. But I’m not sure that .NET Minimal APIs can work with trusted connections. So, I searched for that and came across this link. That link, to me, suggests that Minimal APIs cannot work with trusted connections. I’d like to know if I’m correct, please.