How can a manage user secrets for .Net MAUI app

305 Views Asked by At

I am looking for a way to use secrets for a .Net MAUI app. I need to be able to debug locally, but I cannot let secrets be stored in source control.

And in my Azure release pipeline, I need different secrets values to be used for different stages (dev and store).

I cannot find a solution for that so far. I did find a suggestion to store secrets in Key Vault and use Azure functions to retrieve them. But the secrets I have contain information my app needs to call my Azure functions. So here I see a vicious circle.

ADDED:

I tried this code to get my secrets from the key vault:

    IConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
    IConfigurationRoot configuration = configurationBuilder.Build();

    configurationBuilder.AddAzureKeyVault(new Uri("https://myvault.vault.azure.net/"), new DefaultAzureCredential());
    configuration = configurationBuilder.Build();

But this throws an exception: Azure.Identity.AuthenticationFailedException Message=ManagedIdentityCredential authentication failed: Confidential client and managed identity flows are not available on mobile platforms and on Mac.

0

There are 0 best solutions below