Skip to content

Commit 447284f

Browse files
committed
udpate auth instructions
1 parent 568fb75 commit 447284f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

docs/azure/sdk/aspnetcore-guidance.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,17 @@ Use the [Azure Identity](/dotnet/api/overview/azure/identity-readme) library for
7474
> [!NOTE]
7575
> Many Azure services also allow you to authorize requests using 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 can authorize requests against the associated Azure resource.
7676
77-
Consider the following use of `DefaultAzureCredential`:
77+
1. Add the [Azure.Identity](https://www.nuget.org/packages/Azure.Identity) package:
78+
79+
```dotnetcli
80+
dotnet add package Azure.Identity
81+
```
82+
83+
1. In the `Program.cs` file of your app, invoke the `UseCredential` extension method from the `Microsoft.Extensions.Azure` library to set a shared `DefaultAzureCredential` instance for all registered Azure service clients:
7884

7985
:::code language="csharp" source="snippets/aspnetcore-guidance/BlazorSample/Program.cs" range="11-30" highlight="19":::
8086

81-
In the preceding code, the `UseCredential` method accepts an instance of `DefaultAzureCredential` to reuse across your registered services. `DefaultAzureCredential` discovers available credentials in the current environment and uses them to authenticate to Azure services. For the order and locations in which `DefaultAzureCredential` scans for credentials, see [DefaultAzureCredential overview](/dotnet/azure/sdk/authentication/credential-chains?tabs=dac#defaultazurecredential-overview).
87+
`DefaultAzureCredential` discovers available credentials in the current environment and uses them to authenticate to Azure services. For the order and locations in which `DefaultAzureCredential` scans for credentials, see [DefaultAzureCredential overview](/dotnet/azure/sdk/authentication/credential-chains?tabs=dac#defaultazurecredential-overview).
8288

8389
## Apply configurations
8490

0 commit comments

Comments
 (0)