You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -278,7 +283,8 @@ You can also enable access to Azure resources for local development by assigning
278
283
from azure.storage.blob import BlobServiceClient
279
284
import os
280
285
281
-
# Create an instance of DefaultAzureCredential that will use a system-assigned managed identity
286
+
# Create DefaultAzureCredential instance that uses system-assigned managed identity
287
+
# in the underlying ManagedIdentityCredential.
282
288
credential = DefaultAzureCredential()
283
289
284
290
blob_service_client = BlobServiceClient(
@@ -300,7 +306,7 @@ You can also enable access to Azure resources for local development by assigning
300
306
301
307
When this code runs locally, `DefaultAzureCredential` searches a credential chain for the first available credentials. If the `Managed_Identity_Client_ID` is null locally, it will automatically use the credentials from your local Azure CLI or Visual Studio sign-in. You can read more about this process in the [Azure Identity library overview](/dotnet/api/overview/azure/Identity-readme#defaultazurecredential).
302
308
303
-
When the application is deployed to Azure, `DefaultAzureCredential` will automatically retrieve the `Managed_Identity_Client_ID` variable from the app service environment. That value becomes available when a managed identity is associated with your app.
309
+
When the application is deployed to Azure, `DefaultAzureCredential` automatically retrieves the `Managed_Identity_Client_ID` variable from the App Service environment. That value becomes available when a managed identity is associated with your app.
304
310
305
311
This overall process ensures that your app can run securely locally and in Azure without the need for any code changes.
306
312
@@ -313,11 +319,11 @@ Although the apps in the previous example all shared the same service access req
313
319
To configure this setup in your code, ensure your application registers separate service clients to connect to each storage account or database. Reference the correct managed identity client IDs for each service when configuring `DefaultAzureCredential`. The following code sample configures these Azure service connections:
314
320
315
321
* Two connections to separate storage accounts using a shared user-assigned managed identity
316
-
* A connection to Azure Cosmos DB and Azure SQL services using a second shared user-assigned managed identity
322
+
* A connection to Azure Cosmos DB and Azure SQL services using a second user-assigned managed identity. This managed identity is shared when the Azure SQL client driver allows for it; see the code comments for more details.
317
323
318
324
### [.NET](#tab/csharp)
319
325
320
-
1. In your project, install the `Azure.Identity` package. This library provides `DefaultAzureCredential`. Install any other [Azure SDK libraries](https://www.npmjs.com/search?q=%40azure) which are relevant to your app.
326
+
1. In your project, install the required packages. The Azure Identity library provides `DefaultAzureCredential`.
321
327
322
328
```dotnetcli
323
329
dotnet add package Azure.Identity
@@ -346,19 +352,21 @@ To configure this setup in your code, ensure your application registers separate
346
352
ManagedIdentityClientId = clientIdStorage,
347
353
});
348
354
349
-
// First Blob Storage client that uses a user-assigned managed identity
355
+
// First Blob Storage client
350
356
BlobServiceClient blobServiceClient1 = new(
351
357
new Uri("https://<receipt-storage-account>.blob.core.windows.net"),
352
358
credentialStorage);
353
359
354
-
// Second Blob Storage client that uses a user-assigned managed identity
360
+
// Second Blob Storage client
355
361
BlobServiceClient blobServiceClient2 = new(
356
362
new Uri("https://<contract-storage-account>.blob.core.windows.net"),
357
363
credentialStorage);
358
364
359
-
// Get the second user-assigned managed identity client ID to connect to shared databases
@@ -539,7 +554,7 @@ To configure this setup in your code, ensure your application registers separate
539
554
1. Add the following to your code:
540
555
541
556
> [!NOTE]
542
-
> Spring Cloud Azure doesn't support configure multiple clients of the same service, the following codes create multiple beans for this situation.
557
+
> Spring Cloud Azure doesn't support configure multiple clients of the same service, the following code samples create multiple beans for this situation.
543
558
544
559
```java
545
560
@Configuration
@@ -578,7 +593,7 @@ To configure this setup in your code, ensure your application registers separate
578
593
579
594
### [Node.js](#tab/javascript)
580
595
581
-
1. In your project, install the `@azure/identity` package. This library provides `DefaultAzureCredential`. Install any other [Azure SDK libraries](https://www.npmjs.com/search?q=%40azure) which are relevant to your app.
596
+
1. In your project, install the required packages. The Azure Identity library provides `DefaultAzureCredential`.
These types of scenarios are explored in more depth in the [identities best practice recommendations](../../active-directory/managed-identities-azure-resources/managed-identity-best-practice-recommendations.md).
722
+
These types of scenarios are explored in more depth in the [managed identity best practice recommendations](/entra/identity/managed-identities-azure-resources/managed-identity-best-practice-recommendations).
0 commit comments