Hello @Fredrik Olsen , in order to avoid giving access to a database connection string from your local application you could move the database access workload to a custom API. APIS are best suited to store secrets such as password and connection strings. You application would authenticate and get authorized against your API which in turn would get authorized to gain access to KeyVault or better yet, directly to your database (provided is deployed in the cloud).
Take a look to the following docs for more information:
- Desktop app that calls web APIs
- Mobile application that calls web APIs
- On-behalf-of flows with MSAL.NET or Client credential flows in MSAL.NET
- Microsoft Authentication Library for iOS and macOS
- Managed identities for Azure resources documentation: to avoid handling credentials in your API + Which SDK to use - Azure SDK or MSAL?
- About Azure Mobile Apps: client and api multiplatform all in one developement that avoids separate client and API development
Let us know if you need additional assistance. If the answer was helpful, please accept it and rate it so that others facing a similar issue can easily find a solution.