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
+76-91Lines changed: 76 additions & 91 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Managed identities are most easily implemented in your application code through
39
39
40
40
## Connect an Azure-hosted app to multiple Azure services
41
41
42
-
You have been tasked with connecting an existing app to multiple Azure services and databases using passwordless connections. The application is an ASP.NET Core Web API hosted on Azure App Service, though the steps below apply to other Azure hosting environments as well, such as Azure Spring Apps, Virtual Machines, Container Apps, and AKS.
42
+
Imagine you're tasked with connecting an existing app to multiple Azure services and databases using passwordless connections. The application is an ASP.NET Core Web API hosted on Azure App Service, though the steps below apply to other Azure hosting environments as well, such as Azure Spring Apps, Virtual Machines, Container Apps, and AKS.
43
43
44
44
This tutorial applies to the following architectures, though it can be adapted to many other scenarios as well through minimal configuration changes.
45
45
@@ -94,34 +94,30 @@ You can also enable access to Azure resources for local development by assigning
94
94
95
95
#### [.NET](#tab/csharp)
96
96
97
-
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.KeyVault.Keys` packages are added to connect to Blob Storage and Key Vault, respectively.
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.KeyVault.Keys` packages are added to connect to Blob Storage and Key Vault, respectively.
98
98
99
-
```dotnetcli
100
-
dotnet add package Azure.Identity
101
-
dotnet add package Azure.Storage.Blobs
102
-
dotnet add package Azure.KeyVault.Keys
103
-
```
104
-
105
-
At the top of your `Program.cs` file, add the following `using` statements:
106
-
107
-
```csharp
108
-
usingAzure.Identity;
109
-
usingAzure.Storage.Blobs;
110
-
usingAzure.Security.KeyVault.Keys;
111
-
```
112
-
113
-
In the `Program.cs` file of your project, create instances of the necessary services your app will connect to. The following examples connect to Blob Storage and Service Bus using the corresponding service clients.
1. In the `Program.cs` file of your project, instantiate service clients for the services your app will connect to. The following examples connect to Blob Storage and Service Bus using the corresponding service clients.
In your project, you only need to add service dependencies you use. For this example, the `spring-cloud-azure-starter-storage-blob` and `spring-cloud-azure-starter-servicebus` dependencies are added in order to connect to Blob Storage and Key Vault.
Create instances of the service clients for the services your app will connect to. The following examples connect to Blob Storage and Service Bus using the corresponding service clients.
1. In your project, you only need to add service dependencies you use. For this example, the `spring-cloud-azure-starter-storage-blob` and `spring-cloud-azure-starter-servicebus` dependencies are added in order to connect to Blob Storage and Key Vault.
1. Create instances of the service clients for the services your app will connect to. The following examples connect to Blob Storage and Service Bus using the corresponding service clients.
1. At the top of your `index.js` file, add the following `import` statements to import the necessary service clients for the services your app will connect to:
240
+
1. In the `index.js` file, create client objects for the Azure services your app will connect to. The following examples connect to Blob Storage and Key Vault using the corresponding service clients.
247
241
248
242
```javascript
249
243
import { DefaultAzureCredential } from "@azure/identity";
250
244
import { BlobServiceClient } from "@azure/storage-blob";
251
245
import { KeyClient } from "@azure/keyvault-keys";
252
-
```
253
246
254
-
1. Within the `index.js` file, create client objects for the Azure services your app will connect to. The following examples connect to Blob Storage and Key Vault using the corresponding service clients.
2. At the top of your `index.js` file, add the following `import` statements to import the necessary service clients for the services your app will connect to:
543
+
1. In the `index.js` file, create client objects forthe Azure services your app will connect to. The following examples connect to Blob Storage, Cosmos DB, and Azure SQL using the corresponding service clients.
555
544
556
545
```javascript
557
546
import { DefaultAzureCredential } from "@azure/identity";
558
547
import { BlobServiceClient } from "@azure/storage-blob";
559
548
import { KeyClient } from "@azure/keyvault-keys";
560
-
```
561
549
562
-
3. Within the `index.js` file, create client objects for the Azure services your app will connect to. The following examples connect to Blob Storage, Cosmos DB, and Azure SQL using the corresponding service clients.
563
-
564
-
```javascript
565
550
// Get the first user-assigned managed identity client ID to connect to shared storage
0 commit comments