Skip to content

Commit ef9c9eb

Browse files
committed
updates
1 parent ee2cb3f commit ef9c9eb

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

docs/azure/sdk/aspnetcore-guidance.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The Azure SDK for .NET enables ASP.NET Core apps to integrate with many differen
1616
- Configure common web app concerns such as logging and retries.
1717
- Get started with additional topics such unit testing.
1818

19-
## Register service clients and subclients
19+
## Register service clients
2020

2121
The Azure SDK for .NET provides many service clients to connect your app to 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 assisting with authentication credential management.
2222

@@ -101,7 +101,7 @@ To register the services you need, complete the following steps.
101101
102102
---
103103
104-
## Handle configuration
104+
## Set up service configurations
105105
106106
Azure service clients support configurations to change their default behaviors. You can define service client configurations directly in your code when you register a service. For example, in the [Register clients and subclients](#register-service-clients-and-subclients) section, you explicitly passed the Uri-typed variables to the client constructors. However, the recommended approach is to [store configurations in environment-dependent JSON files](/dotnet/core/extensions/configuration-providers#json-configuration-provider). For example, use an `appsettings.Development.json` file to store development environment settings and an `appsettings.Production.json` file to contain production environment settings. You can add any properties from the [`ClientOptions`](/dotnet/api/azure.core.clientoptions) class into the JSON file.
107107
@@ -177,21 +177,15 @@ Update your configuration file to set a new default retry policy, as well as a s
177177
"Retry": {
178178
"maxRetries": 10
179179
}
180-
},
181-
"ServiceBus": {
182-
"Namespace": "<your_namespace>.servicebus.windows.net"
183-
},
184-
"Storage": {
185-
"ServiceUri": "https://mydemoaccount.storage.windows.net"
186180
}
187181
}
188182
```
189183

190-
## Configure authentication
184+
## Authenticate using Microsoft Entra ID
191185

192-
Application requests to Azure services must be authorized. Use the Azure Identity client library to implement secretless connections to Azure services in your code, such as Azure Blob Storage. The Azure Identity client library provides tools such as `DefaultAzureCredential` to simplify configuring secure connections. `DefaultAzureCredential` is a class provided by the Azure Identity client library for .NET, which you can learn more about on the [`DefaultAzureCredential`](/dotnet/azure/sdk/authentication#defaultazurecredential). `DefaultAzureCredential` supports multiple authentication methods and determines which method should be used at runtime. This approach enables your app to use different authentication methods in different environments (local vs. production) without implementing environment-specific code.
186+
Microsoft Entra ID is the recommended approach to authorize requests to Azure services. Use the [Azure Identity client library]() to implement secretless connections to Azure services in your code. The Azure Identity client library provides tools such as `DefaultAzureCredential` to simplify configuring secure connections. `DefaultAzureCredential` supports multiple authentication methods and determines which method should be used at runtime. This approach enables your app to use different authentication methods in different environments (local vs. production) without implementing environment-specific code.
193187

194-
Some Azure services allow all you to authorize requests using secrets keys. However, this approach should be used with caution. Developers must be diligent to never expose the access key in an unsecure location. Anyone who has the access key is able to authorize requests against the storage account, and effectively has access to all the data.
188+
Some Azure services also allow you to authorize requests using secrets keys. However, this approach should be used with caution. Developers must be diligent to never expose the access key in an unsecure location. Anyone who has the access key is able to authorize requests against the service and data.
195189

196190
Consider the following service client registrations:
197191

@@ -215,25 +209,25 @@ builder.Services.AddAzureClients(clientBuilder =>
215209
});
216210
```
217211

218-
In the preceding code, the `clientBuilder.UseCredential()` method accepts an instance of `DefaultAzureCredential` that will be reused across your registered services. This single line of code discovers available credentials in the current environment and use them to connect to Azure services, such as locally or when deployed in the cloud. No code changes are required for this transition.
212+
In the preceding code, the `clientBuilder.UseCredential()` method accepts an instance of `DefaultAzureCredential` that will be reused across your registered services. `DefaultAzureCredential` discovers available credentials in the current environment and use them to connect to Azure services. The full order and locations in which `DefaultAzureCredential` looks for credentials can be found in the [`Azure Identity library overview`](/dotnet/api/overview/azure/Identity-readme#defaultazurecredential).
219213

220-
The full order and locations in which `DefaultAzureCredential` looks for credentials can be found in the [`Azure Identity library overview`](/dotnet/api/overview/azure/Identity-readme#defaultazurecredential). For example, when you run the app locally, `DefaultAzureCredential` discovers and uses credentials from the following developer tools:
214+
For example, when you run the app locally, `DefaultAzureCredential` discovers and uses credentials from the following developer tools:
221215

222216
- Environment variables
223217
- Visual Studio
224218
- Azure CLI
225219
- Azure PowerShell
226220
- Azure Developer CLI
227221

228-
`DefaultAzureCredential` also discovers and uses credentials from deployed services:
222+
`DefaultAzureCredential` also discovers credentials after you deploy your app from the following:
229223

230224
- Environment variables
231225
- Workload identity
232226
- Managed identity
233227

234228
## Configure logging
235229

236-
The Azure SDK for .NET client libraries include the ability to log client library operations. This logging allows you to monitor requests and responses between services clients and Azure services. When you register the Azure SDK library's client via a call to the <xref:Microsoft.Extensions.Azure.AzureClientServiceCollectionExtensions.AddAzureClients%2A> extension method, some logging configurations are handled for you.
230+
The Azure SDK for .NET client libraries include the ability to log client library operations. This logging allows you to monitor requests and responses between services clients and Azure services. When you register the Azure SDK library's client via a call to the <xref:Microsoft.Extensions.Azure.AzureClientServiceCollectionExtensions.AddAzureClients%2A> extension method, some logging configurations are handled for you.
237231

238232
```csharp
239233
```csharp
@@ -263,7 +257,7 @@ In the preceding sample, the `AddAzureClients` method:
263257
- Azure Service Bus client
264258
- Sets the default token credential to be used for all registered clients.
265259

266-
You can change default log levels and other settings using the same JSON configurations outlined in the [configure authentication](#configure-authentiation) section. For example, toggle a the `ServiceBusClient` log level to `Debug` by setting the `Logging:LogLevel:Azure.Messaging.ServiceBus` key as follows:
260+
You can change default log levels and other settings using the same JSON configurations outlined in the [configure authentication](#configure-authentication) section. For example, toggle a the `ServiceBusClient` log level to `Debug` by setting the `Logging:LogLevel:Azure.Messaging.ServiceBus` key as follows:
267261

268262
```json
269263
{

0 commit comments

Comments
 (0)