In my xamarin forms app I have the need to call some azure functions in a secure way.
What I have done
- All my functions have AuthorizationLevel=Function
- Get Function Key by making a call to a webApi that is stored on the server
- Function Key is passed in the header of the http call (all works!!)
I do not like the above and definitely I do not want to store the function key on the mobile app as an alternative
I have read about Authentication/Authorization but I cannot figure out if it fits my scenario
My Scenario
Ability to call an azure function in a secure way.User should NOT be prompted to login.Its a silent call.
Is there some sort of accessToken I can use and retrieve safely from azure portal and use that in some way to access the function?
How do you securely access an azure function in a mobile app?
Any samples? I have read below and did not help
https://docs.microsoft.com/en-us/azure/app-service/overview-authentication-authorization https://docs.microsoft.com/en-us/azure/app-service/configure-authentication-provider-aad
Edited
Tried below but I get an error(connection string error) in the mobile app.Also not sure how it works when deployed as in debug it uses the credential of the developer

var azureServiceTokenProvider = new AzureServiceTokenProvider();
var keyVaultClient =
new KeyVaultClient(
new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));
var secret = await keyVaultClient.GetSecretAsync("mysecretIdentifier").ConfigureAwait(false);
var key = secret.Value;