From 13b2a6ade13a254f23d27288b8afa8883dfa8ba5 Mon Sep 17 00:00:00 2001 From: Jan de Vries Date: Tue, 17 Sep 2024 16:00:47 +0200 Subject: [PATCH] Changed because identity isn't found Due to: https://github.com/microsoft/azure-container-apps/issues/442 --- .../Controllers/AllTheDataController.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/auth-with-obo/IntegratingService/Controllers/AllTheDataController.cs b/src/auth-with-obo/IntegratingService/Controllers/AllTheDataController.cs index 61baadf..116e7eb 100644 --- a/src/auth-with-obo/IntegratingService/Controllers/AllTheDataController.cs +++ b/src/auth-with-obo/IntegratingService/Controllers/AllTheDataController.cs @@ -186,12 +186,8 @@ private async Task GenerateAccessToken(string requestedScope) else { _logger.LogInformation("Running in Azure. Using DefaultAzureCredential with Managed Identity `{ManagedIdentityClientId}` to get access token.", userAssignedClientId); - var tokenCredential = new DefaultAzureCredential( - new DefaultAzureCredentialOptions - { - ManagedIdentityClientId = userAssignedClientId - } - ); + + var tokenCredential = new ManagedIdentityCredential(userAssignedClientId); AccessToken accessToken; if(string.IsNullOrEmpty(requestedScope))