|
17 | 17 | }, EventLevel.LogAlways);
|
18 | 18 | #endregion snippet_FilteredLogging
|
19 | 19 |
|
| 20 | +#region snippet_Dac |
20 | 21 | builder.Services.AddAzureClients(clientBuilder =>
|
21 | 22 | {
|
22 | 23 | clientBuilder.AddBlobServiceClient(
|
23 | 24 | new Uri("https://<account-name>.blob.core.windows.net"));
|
24 |
| - #region snippet_Dac |
| 25 | + |
25 | 26 | DefaultAzureCredential credential = new();
|
26 | 27 | clientBuilder.UseCredential(credential);
|
27 |
| - #endregion snippet_Dac |
| 28 | +}); |
| 29 | +#endregion snippet_Dac |
| 30 | + |
| 31 | +#region snippet_DacExcludes |
| 32 | +builder.Services.AddAzureClients(clientBuilder => |
| 33 | +{ |
| 34 | + clientBuilder.AddBlobServiceClient( |
| 35 | + new Uri("https://<account-name>.blob.core.windows.net")); |
28 | 36 |
|
29 |
| - #region snippet_DacExcludes |
30 | 37 | clientBuilder.UseCredential(new DefaultAzureCredential(
|
31 | 38 | new DefaultAzureCredentialOptions
|
32 | 39 | {
|
33 | 40 | ExcludeEnvironmentCredential = true,
|
34 | 41 | ExcludeWorkloadIdentityCredential = true,
|
35 | 42 | ManagedIdentityClientId = userAssignedClientId,
|
36 | 43 | }));
|
37 |
| - #endregion snippet_DacExcludes |
| 44 | +}); |
| 45 | +#endregion snippet_DacExcludes |
| 46 | + |
| 47 | +#region snippet_Ctc |
| 48 | +builder.Services.AddAzureClients(clientBuilder => |
| 49 | +{ |
| 50 | + clientBuilder.AddBlobServiceClient( |
| 51 | + new Uri("https://<account-name>.blob.core.windows.net")); |
38 | 52 |
|
39 |
| - #region snippet_Ctc |
40 | 53 | clientBuilder.UseCredential(new ChainedTokenCredential(
|
41 | 54 | new ManagedIdentityCredential(clientId: userAssignedClientId),
|
42 | 55 | new VisualStudioCredential()));
|
43 |
| - #endregion snippet_Ctc |
44 | 56 | });
|
| 57 | +#endregion snippet_Ctc |
| 58 | + |
45 | 59 |
|
46 | 60 | builder.Services.AddEndpointsApiExplorer();
|
47 | 61 | builder.Services.AddSwaggerGen();
|
|
0 commit comments