I have a code similar to this:
new KeyVaultClient(new TokenCredentials(myBearerToken));
But, I'm migrating from AppAuthentication to Azure.Identity, so I have followed this guide: https://learn.microsoft.com/en-us/dotnet/api/overview/azure/app-auth-migration?view=azure-dotnet. The main problem is that I can not find a way to use Bearer Token, I have tried this:
new SecretClient(new Uri(keyVaultURI), new ClientSecretCredential(tenantId, clientId, myBearerToken));
Is there any way to accomplish this migration with a Bearer Token?
The way I have solved this problem is by creating a new class that extends
TokenCredentialclass fromAzure.Corenamespace (ClientSecretCredentialalso extends the same class) and pass the bearer token in its constructor.This is how my code looks like: