Skip to content

Commit d37f469

Browse files
authored
Add clarity to UseCredential call (#43591)
1 parent eb12a9f commit d37f469

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

docs/azure/sdk/authentication/credential-chains.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 'Credential chains in the Azure Identity library for .NET'
33
description: 'This article describes the DefaultAzureCredential and ChainedTokenCredential classes in the Azure Identity library.'
44
ms.topic: conceptual
5-
ms.date: 11/12/2024
5+
ms.date: 11/15/2024
66
---
77

88
# Credential chains in the Azure Identity library for .NET
@@ -63,7 +63,10 @@ The order in which `DefaultAzureCredential` attempts credentials follows.
6363

6464
In its simplest form, you can use the parameterless version of `DefaultAzureCredential` as follows:
6565

66-
:::code language="csharp" source="../snippets/authentication/credential-chains/Program.cs" id="snippet_Dac":::
66+
:::code language="csharp" source="../snippets/authentication/credential-chains/Program.cs" id="snippet_Dac" highlight="1":::
67+
68+
> [!TIP]
69+
> The `UseCredential` method in the preceding code snippet is recommended for use in ASP.NET Core apps. For more information, see [Use the Azure SDK for .NET in ASP.NET Core apps](../aspnetcore-guidance.md#authenticate-using-microsoft-entra-id).
6770
6871
### How to customize DefaultAzureCredential
6972

docs/azure/sdk/snippets/authentication/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<!-- Azure SDK packages -->
7-
<PackageVersion Include="Azure.Identity" Version="1.12.0" />
7+
<PackageVersion Include="Azure.Identity" Version="1.13.1" />
88
<PackageVersion Include="Azure.Identity.Broker" Version="1.1.0" />
99
<PackageVersion Include="Azure.Storage.Blobs" Version="12.21.2" />
1010
<PackageVersion Include="Microsoft.Extensions.Azure" Version="1.7.5" />

docs/azure/sdk/snippets/authentication/additional-auth/interactive/InteractiveBrokeredAuth.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net8.0-windows</TargetFramework>
5+
<TargetFramework>net9.0-windows</TargetFramework>
66
<Nullable>enable</Nullable>
77
<UseWindowsForms>true</UseWindowsForms>
88
<ImplicitUsings>enable</ImplicitUsings>

docs/azure/sdk/snippets/authentication/credential-chains/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
clientBuilder.AddBlobServiceClient(
2323
new Uri("https://<account-name>.blob.core.windows.net"));
2424
#region snippet_Dac
25-
clientBuilder.UseCredential(new DefaultAzureCredential());
25+
DefaultAzureCredential credential = new();
26+
clientBuilder.UseCredential(credential);
2627
#endregion snippet_Dac
2728

2829
#region snippet_DacExcludes

0 commit comments

Comments
 (0)