You can secure your secrets like passwords and database connection strings by saving them in Azure Key Vault. Azure Key Vault is a cloud service offered by Microsoft to securely store cryptographic keys, certificates, and secrets. You can access the secrets stored in Key Vault using native client (say written in C#). To access the secrets you have to follow these steps:

1. Login to azure portal –

Register your Native App

2. Go to Azure Active Directory –> App Registrations, click on +New application registration

3. One the new screen, provide a name for the app, select ‘Native’ as Application Type, provide any dummy URI (need not be real one) and click Create:

4. Once the App is registered, note down the application id:

5. On he same screen click on Settings–>Required permissions –> +Add –> Select Azure Key Vault API to give access to this native app:

Under Select permissions, select Delegated permissions and click Done:

6.Now Go to Azure Active Directory –> Properties, Copy the value shown under Directory Id. this is also the Tenant Id which will be used for accessing the Key Vault:

7. Create a Key Vault and add a secret into it. In case you already have Key Vault and a Secret created in it then go to next step:

8. Open Visual studio and create a new .Net Framework project and import these NuGet packages:

9. Add the below code to program.cs:

10. Build and run to see the secrets value in console.