Skip to content

Commit 255d0ab

Browse files
feat: Add TokenCrendtial for Azure DevOps Pipeline
1 parent 0e6326e commit 255d0ab

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/Core/EnvironmentConfigurationExtension.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ public static EnvironmentConfiguration AddEnvironmentConfiguration(
6060
managedIdentityResourceIdFunc(environmentConfiguration)),
6161
RuntimeEnvironment.Cloud when managedIdentityResourceIdFunc is null => new ManagedIdentityCredential(),
6262
RuntimeEnvironment.UnitTest => new TokenCredentialMock(),
63+
RuntimeEnvironment.BuildServer => new AzurePipelinesCredential(
64+
tenantId: Environment.GetEnvironmentVariable("APP_REG_TENANT_ID") ?? throw new InvalidOperationException("APP_REG_TENANT_ID environment variable is not set."),
65+
clientId: Environment.GetEnvironmentVariable("APP_REG_CLIENT_ID") ?? throw new InvalidOperationException("APP_REG_CLIENT_ID environment variable is not set."),
66+
serviceConnectionId: Environment.GetEnvironmentVariable("APP_REG_SERVICE_CONNECTION_ID") ?? throw new InvalidOperationException("APP_REG_SERVICE_CONNECTION_ID environment variable is not set."),
67+
systemAccessToken: Environment.GetEnvironmentVariable("SYSTEM_ACCESS_TOKEN") ?? throw new InvalidOperationException("SYSTEM_ACCESS_TOKEN environment variable is not set.")),
6368
_ => throw new NotSupportedException(
6469
$"Runtime environment {environmentConfiguration.RuntimeEnvironment} is not supported"),
6570
};

0 commit comments

Comments
 (0)