Skip to content

Commit f1ac15c

Browse files
committed
- Adding new file missed in previous commit.
1 parent 85e71bd commit f1ac15c

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

eng/pipelines/dotnet-sqlclient-ci-package-reference-pipeline.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ parameters: # parameters are shown up in ADO UI in a build queue time
133133
type: string
134134
default: 90
135135

136+
# Dotnet CLI verbosity level.
137+
- name: dotnetVerbosity
138+
displayName: dotnet CLI Verbosity
139+
type: string
140+
default: normal
141+
values:
142+
- quiet
143+
- minimal
144+
- normal
145+
- detailed
146+
- diagnostic
147+
136148
extends:
137149
template: dotnet-sqlclient-ci-core.yml@self
138150
parameters:
@@ -147,3 +159,4 @@ extends:
147159
buildConfiguration: ${{ parameters.buildConfiguration }}
148160
enableStressTests: ${{ parameters.enableStressTests }}
149161
testsTimeout: ${{ parameters.testsTimeout }}
162+
dotnetVerbosity: ${{ parameters.dotnetVerbosity }}

eng/pipelines/dotnet-sqlclient-ci-project-reference-pipeline.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ parameters: # parameters are shown up in ADO UI in a build queue time
133133
type: string
134134
default: 90
135135

136+
# Dotnet CLI verbosity level.
137+
- name: dotnetVerbosity
138+
displayName: dotnet CLI Verbosity
139+
type: string
140+
default: normal
141+
values:
142+
- quiet
143+
- minimal
144+
- normal
145+
- detailed
146+
- diagnostic
147+
136148
extends:
137149
template: dotnet-sqlclient-ci-core.yml@self
138150
parameters:
@@ -147,3 +159,4 @@ extends:
147159
buildConfiguration: ${{ parameters.buildConfiguration }}
148160
enableStressTests: ${{ parameters.enableStressTests }}
149161
testsTimeout: ${{ parameters.testsTimeout }}
162+
dotnetVerbosity: ${{ parameters.dotnetVerbosity }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using Azure.Identity;
6+
7+
namespace Microsoft.Data.SqlClient.Extensions.Azure.Test;
8+
9+
// Verify that we're running in an environment that supports Azure Pipelines
10+
// Workload Identity Federation authentication.
11+
public class WorkloadIdentityFederationTests
12+
{
13+
[ConditionalFact(typeof(Config), nameof(Config.HasSystemAccessToken))]
14+
public async void GetCredential()
15+
{
16+
AzurePipelinesCredential credential = new(
17+
// The tenant ID if the managed identity associated to our workload
18+
// identity federation service connection. See:
19+
//
20+
// https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/654fffd0-d02d-4894-b1b7-e2dfbc44a665/resourceGroups/aad-testlab-dl797892652000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/dotnetMSI/properties
21+
"72f988bf-86f1-41af-91ab-2d7cd011db47",
22+
// The client ID of the managed identity associated to our workload
23+
// identity federation service connection. See:
24+
//
25+
// https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/654fffd0-d02d-4894-b1b7-e2dfbc44a665/resourceGroups/aad-testlab-dl797892652000/providers/Microsoft.ManagedIdentity/userAssignedIdentities/dotnetMSI/overview
26+
"92a44a21-5265-4fdd-9537-45b1cf54aa2d",
27+
28+
// The Azure Dev Ops service connection ID (resourceId found in the
29+
// URL) of our workload identity federation setup. See:
30+
//
31+
// https://sqlclientdrivers.visualstudio.com/public/_settings/adminservices?resourceId=ec9623b2-829c-497f-ae1f-7461766f9a9c
32+
"ec9623b2-829c-497f-ae1f-7461766f9a9c",
33+
Config.SystemAccessToken);
34+
35+
// Acquire a token suitable for accessing Azure SQL databases.
36+
var token = await credential.GetTokenAsync(
37+
new(["https://database.windows.net/.default"]),
38+
CancellationToken.None);
39+
40+
Assert.NotEmpty(token.Token);
41+
}
42+
}

0 commit comments

Comments
 (0)