diff --git a/docs/azure/sdk/authentication/credential-chains.md b/docs/azure/sdk/authentication/credential-chains.md index 6cd53039cce85..d03dc0f5b22f9 100644 --- a/docs/azure/sdk/authentication/credential-chains.md +++ b/docs/azure/sdk/authentication/credential-chains.md @@ -2,7 +2,7 @@ title: 'Credential chains in the Azure Identity library for .NET' description: 'This article describes the DefaultAzureCredential and ChainedTokenCredential classes in the Azure Identity library.' ms.topic: conceptual -ms.date: 11/12/2024 +ms.date: 11/15/2024 --- # Credential chains in the Azure Identity library for .NET @@ -63,7 +63,10 @@ The order in which `DefaultAzureCredential` attempts credentials follows. In its simplest form, you can use the parameterless version of `DefaultAzureCredential` as follows: -:::code language="csharp" source="../snippets/authentication/credential-chains/Program.cs" id="snippet_Dac"::: +:::code language="csharp" source="../snippets/authentication/credential-chains/Program.cs" id="snippet_Dac" highlight="1"::: + +> [!TIP] +> 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). ### How to customize DefaultAzureCredential diff --git a/docs/azure/sdk/snippets/authentication/Directory.Packages.props b/docs/azure/sdk/snippets/authentication/Directory.Packages.props index c9c1cf5d4e720..49ef5dc43aac3 100644 --- a/docs/azure/sdk/snippets/authentication/Directory.Packages.props +++ b/docs/azure/sdk/snippets/authentication/Directory.Packages.props @@ -4,7 +4,7 @@ - + diff --git a/docs/azure/sdk/snippets/authentication/additional-auth/interactive/InteractiveBrokeredAuth.csproj b/docs/azure/sdk/snippets/authentication/additional-auth/interactive/InteractiveBrokeredAuth.csproj index a5e31ad6f9ee0..84386f52bf895 100644 --- a/docs/azure/sdk/snippets/authentication/additional-auth/interactive/InteractiveBrokeredAuth.csproj +++ b/docs/azure/sdk/snippets/authentication/additional-auth/interactive/InteractiveBrokeredAuth.csproj @@ -2,7 +2,7 @@ WinExe - net8.0-windows + net9.0-windows enable true enable diff --git a/docs/azure/sdk/snippets/authentication/credential-chains/Program.cs b/docs/azure/sdk/snippets/authentication/credential-chains/Program.cs index 06eb79507d8c2..534a361ebbd05 100644 --- a/docs/azure/sdk/snippets/authentication/credential-chains/Program.cs +++ b/docs/azure/sdk/snippets/authentication/credential-chains/Program.cs @@ -22,7 +22,8 @@ clientBuilder.AddBlobServiceClient( new Uri("https://.blob.core.windows.net")); #region snippet_Dac - clientBuilder.UseCredential(new DefaultAzureCredential()); + DefaultAzureCredential credential = new(); + clientBuilder.UseCredential(credential); #endregion snippet_Dac #region snippet_DacExcludes