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
Copy file name to clipboardExpand all lines: articles/storage/common/multiple-identity-scenarios.md
+73-18Lines changed: 73 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,7 @@ You can also enable access to Azure resources for local development by assigning
94
94
95
95
#### [.NET](#tab/csharp)
96
96
97
-
1. In your project, add a reference to the `Azure.Identity` NuGet package. This library contains the necessary entities to implement`DefaultAzureCredential`. You can also add any other Azure libraries that are relevant to your app. For this example, the `Azure.Storage.Blobs` and `Azure.Messaging.ServiceBus` packages are added to connect to Blob Storage and Service Bus, respectively.
97
+
1. In your project, install the `Azure.Identity` NuGet package. This library provides`DefaultAzureCredential`. You can also add any other Azure libraries that are relevant to your app. For this example, the `Azure.Storage.Blobs` and `Azure.Messaging.ServiceBus` packages are added to connect to Blob Storage and Service Bus, respectively.
98
98
99
99
```dotnetcli
100
100
dotnet add package Azure.Identity
@@ -230,7 +230,7 @@ You can also enable access to Azure resources for local development by assigning
230
230
231
231
#### [Node.js](#tab/javascript)
232
232
233
-
1. In your project, use [npm](https://docs.npmjs.com/) to add a reference to the `@azure/identity` package. This library provides `DefaultAzureCredential`. For this example, the `@azure/storage-blob` and `@azure/service-bus` packages are installed to interact with Blob Storage and Service Bus.
233
+
1. In your project, install the `@azure/identity` package. This library provides `DefaultAzureCredential`. For this example, the `@azure/storage-blob` and `@azure/service-bus` packages are installed to interact with Blob Storage and Service Bus.
To configure this setup in your code, make sure your application registers separate service clients to connect to each storage account or database. Make sure to pull in the correct managed identity client IDs for each service when configuring `DefaultAzureCredential`. The following code example configures the following service connections:
313
+
To configure this setup in your code, ensure your application registers separate service clients to connect to each storage account or database. Make sure to pull in the correct managed identity client IDs for each service when configuring `DefaultAzureCredential`. The following code sample configures these Azure service connections:
314
314
315
315
* Two connections to separate storage accounts using a shared user-assigned managed identity
316
316
* A connection to Azure Cosmos DB and Azure SQL services using a second shared user-assigned managed identity
317
317
318
318
### [.NET](#tab/csharp)
319
319
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.
321
+
322
+
```dotnetcli
323
+
dotnet add package Azure.Identity
324
+
dotnet add package Azure.Storage.Blobs
325
+
dotnet add package Microsoft.Azure.Cosmos
326
+
dotnet add package Microsoft.Data.SqlClient
327
+
```
328
+
320
329
```csharp
321
330
usingAzure.Core;
322
331
usingAzure.Identity;
@@ -329,7 +338,7 @@ string clientIdStorage =
329
338
330
339
// Create a DefaultAzureCredential instance that configures the underlying
331
340
// ManagedIdentityCredential to use a user-assigned managed identity.
1.Inside of your project, use [npm](https://docs.npmjs.com/) to add a reference to the `@azure/identity` package. This library contains all of the necessary entities to implement`DefaultAzureCredential`. Install any other [Azure SDK libraries](https://www.npmjs.com/search?q=%40azure) which are relevant to your app.
579
+
1.In your project, use [npm](https://docs.npmjs.com/) to add a reference to 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.
1. Create service client objects for the Azure services your app will connect to. The following example connects to Blob Storage, Cosmos DB, and Azure SQL using the corresponding service clients.
661
+
662
+
```python
663
+
from azure.cosmos import CosmosClient
664
+
from azure.identity import DefaultAzureCredential
665
+
from azure.storage.blob import BlobServiceClient
666
+
import os, pyodbc, struct
667
+
668
+
# Create an instance of DefaultAzureCredential that will use a user-assigned managed identity
0 commit comments