Reputation: 48402
I have the following Azure Function, or at least the relevant part of it:
using Microsoft.Azure.Services.AppAuthentication;
using Microsoft.Azure.KeyVault;
using Microsoft.Azure.KeyVault.Models;
using System;
using System.Configuration;
using System.Data.SqlClient;
using System.Threading.Tasks;
public static async Task Run(TimerInfo myTimer, TraceWriter log)
{
AzureServiceTokenProvider tokenProvider = new AzureServiceTokenProvider();
var keyVaultClient = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(tokenProvider.KeyVaultTokenCallback));
var secret = await keyVaultClient.GetSecretAsync("https://xxxxx.vault.azure.net/secrets/TwiloAccountSid");
...
}
When this executes I get an Access Denied error attempting to retrieve the secret. The Azure Function has been registered with Managed Service Identity. It appears there is something else I need to do.
Upvotes: 1
Views: 738