Skip to content

Commit d665c9b

Browse files
Replace DefaultAzureCredential with ManagedIdentityCredential
1 parent 51067de commit d665c9b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

App/backend-api/Microsoft.GS.DPS.Host/Helpers/azure_credential_utils.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ public static class AzureCredentialHelper
99
{
1010
public static TokenCredential GetAzureCredential(string clientId = null)
1111
{
12+
"""
13+
Returns an Azure credential based on the application environment.
14+
If the environment is 'dev', it uses DefaultAzureCredential.
15+
Otherwise, it uses ManagedIdentityCredential.
16+
Args:
17+
client_id (str, optional): The client ID for the Managed Identity Credential.
18+
Returns:
19+
Credential object: Either DefaultAzureCredential or ManagedIdentityCredential.
20+
"""
1221
var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production";
1322

1423
if (string.Equals(env, "Development", StringComparison.OrdinalIgnoreCase))

0 commit comments

Comments
 (0)