Skip to content

Commit 5c9cbee

Browse files
committed
updates
1 parent a2e886f commit 5c9cbee

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

docs/azure/sdk/aspnetcore-guidance.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,23 @@ ms.date: 10/22/2024
1111
The Azure SDK for .NET enables ASP.NET Core apps to integrate with many different Azure services. In this article, you'll learn best practices and the steps to implement the Azure SDK for .NET in your ASP.NET Core apps. You'll learn how to:
1212

1313
- Register services for dependency injection.
14-
- Implement centralized, standardized configuration.
1514
- Authenticate to Azure without using passwords or secrets.
15+
- Implement centralized, standardized configuration.
1616
- Configure common web app concerns such as logging and retries.
1717

18+
## Explore common Azure SDK client libraries
19+
20+
ASP.NET Core apps that connect to Azure services generally depend on the following client libraries:
21+
22+
- [Microsoft.Extensions.Azure](https://www.nuget.org/packages/Microsoft.Extensions.Azure) provides helper methods to properly register your services and handles various concerns for you, such as setting up logging, handling service lifetimes, and authentication credential management.
23+
- [Azure.Identity](https://www.nuget.org/packages/Azure.Identity) provides Microsoft Entra ID authentication support across the Azure SDK. It provides a set of [TokenCredential](/dotnet/api/azure.core.tokencredential?view=azure-dotnet) implementations that can be used to construct Azure SDK clients that support Microsoft Entra authentication.
24+
- `Azure.<service-namespace>` libraries such as [Azure.Storage.Blob](https://www.nuget.org/packages/Azure.Storage.Blobs) and [Azure.Messaging.ServiceBus](https://www.nuget.org/packages/Azure.Messaging.ServiceBus) provide service clients and other types to help you connect to and consume specific Azure services.
25+
26+
In the sections ahead, you'll explore how to implement these libraries in an ASP.NET Core app.
27+
1828
## Register service clients
1929

20-
The Azure SDK for .NET provides service clients to connect your app to Azure services such as Azure Blob Storage and Azure Key Vault. Register these services with the dependency container in the `Program.cs` file of your app to make them available to your app using Dependency Injection. The [Microsoft.Extensions.Azure](https://www.nuget.org/packages/Microsoft.Extensions.Azure) library provides helper methods to properly register your services and handles various concerns for you, such as setting up logging, handling service lifetimes, and authentication credential management.
30+
The Azure SDK for .NET provides service clients to connect your app to Azure services such as Azure Blob Storage and Azure Key Vault. Register these services with the dependency container in the `Program.cs` file of your app to make them available to your app using Dependency Injection.
2131

2232
Complete the following steps to register the services you need:
2333

@@ -39,7 +49,7 @@ Complete the following steps to register the services you need:
3949
4050
:::code language="csharp" source="snippets/aspnetcore-guidance/BlazorSample/Program.cs" range="11-30" highlight="4-7,11-16":::
4151
42-
4. Inject the registered services into your ASP.NET Core app components, services, or API endpoint methods:
52+
4. Inject the registered services into your ASP.NET Core app components, services, or API endpoint:
4353
4454
<!-- markdownlint-disable MD023 -->
4555
## [Minimal API](#tab/api)
@@ -89,7 +99,7 @@ Azure service clients support configurations to change their default behaviors.
8999
- [Configuration files](/dotnet/core/extensions/configuration-providers#json-configuration-provider) are generally the recommended approach because they simplify app deployments between environments and reduce hard coded values.
90100
- Inline code configurations when you register the service client. For example, in the [Register clients and subclients](#register-service-clients) section, you explicitly passed the Uri-typed variables to the client constructors.
91101
92-
In the following sections, complete the steps using the `appsettings.Development.json` file for development settings and the `appsettings.Production.json` file for production environment settings. You can add any properties from the [`ClientOptions`](/dotnet/api/azure.core.clientoptions) class to the JSON file.
102+
Complete the steps in the following sections to update your app to use JSON file configuration. Use the `appsettings.Development.json` file for development settings and the `appsettings.Production.json` file for production environment settings. You can add any properties from the [`ClientOptions`](/dotnet/api/azure.core.clientoptions) class to the JSON file.
93103
94104
### Configure registered services
95105
@@ -104,19 +114,19 @@ In the following sections, complete the steps using the `appsettings.Development
104114
105115
1. Update the the `Program.cs` file to retrieve the JSON file configurations using `IConfiguration` and pass them into your service registrations:
106116
107-
:::code language="csharp" source="snippets/aspnetcore-guidance/MinApiSample/Program.cs" range="13-31" highlight="4-5,7-8,10-11":::
117+
:::code language="csharp" source="snippets/aspnetcore-guidance/MinApiSample/Program.cs" range="13-31" highlight="4-5,7-8,11-12":::
108118
109119
### Configure Azure defaults and retries
110120
111-
At some point, you may want to change default Azure client configurations globally or for a specific service client. For example, you may want different retry settings or to use a different service API version. You can set the retry settings globally or on a per-service basis.
121+
You may want to change default Azure client configurations globally or for a specific service client. For example, you may want different retry settings or to use a different service API version. You can set the retry settings globally or on a per-service basis.
112122
113123
1. Update your configuration file to set default Azure settings, such as a new default retry policy:
114124
115125
:::code language="json" source="snippets/aspnetcore-guidance/MinApiSample/appsettings.Development.json" highlight="9-18":::
116126
117127
2. In the `Program.cs` file, the `ConfigureDefaults` extension method `AddAzureClients` retrieves the default settings and applies them to your services:
118128
119-
:::code language="csharp" source="snippets/aspnetcore-guidance/MinApiSample/Program.cs" range="13-31" highlight="16-17":::
129+
:::code language="csharp" source="snippets/aspnetcore-guidance/MinApiSample/Program.cs" range="13-31" highlight="17-18":::
120130
121131
## Configure logging
122132

0 commit comments

Comments
 (0)