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
+42-4Lines changed: 42 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,7 +122,7 @@ You can also enable access to Azure resources for local development by assigning
122
122
123
123
#### [Java](#tab/java)
124
124
125
-
1. In your project, add the `azure-identity` dependency to your *pom.xml* file. This library contains all the necessary entities to implement `DefaultAzureCredential`. You can also add any other Azure dependencies that are relevant to your app. For this example, the `azure-storage-blob` and `azure-messaging-servicebus` dependencies are added to connect to Blob Storage and Service Bus.
125
+
1. In your project, add the `azure-identity` dependency to your *pom.xml* file. This library provides `DefaultAzureCredential`. You can also add any other Azure dependencies that are relevant to your app. For this example, the `azure-storage-blob` and `azure-messaging-servicebus` dependencies are added to interact with Blob Storage and Service Bus.
126
126
127
127
```xml
128
128
<dependencyManagement>
@@ -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 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.
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.
@@ -262,6 +262,40 @@ You can also enable access to Azure resources for local development by assigning
262
262
);
263
263
```
264
264
265
+
#### [Python](#tab/python)
266
+
267
+
1. In your project, add a reference to the `azure-identity` 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-blob` and `azure-service-bus` packages are added to connect to Blob Storage and Service Bus, respectively.
1. Instantiate service clients for the services your app will connect to. The following code sample interacts with Blob Storage and Service Bus using the corresponding service clients.
274
+
275
+
```python
276
+
from azure.identity import DefaultAzureCredential
277
+
from azure.servicebus import ServiceBusClient, ServiceBusMessage
278
+
from azure.storage.blob import BlobServiceClient
279
+
import os
280
+
281
+
# Create an instance of DefaultAzureCredential that will use a system-assigned managed identity
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).
@@ -530,7 +564,7 @@ public class ExampleService {
530
564
}
531
565
```
532
566
533
-
####[Node.js](#tab/javascript)
567
+
### [Node.js](#tab/javascript)
534
568
535
569
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.
536
570
@@ -605,6 +639,10 @@ public class ExampleService {
605
639
await sql.connect(sqlConfig);
606
640
```
607
641
642
+
### [Python](#tab/python)
643
+
644
+
TODO
645
+
608
646
---
609
647
610
648
You can also associate a user-assigned managed identity and a system-assigned managed identity to a resource simultaneously. This can be useful in scenarios where all of the apps require access to the same shared services, but one of the apps also has a very specific dependency on an additional service. Using a system-assigned managed identity also ensures that the identity tied to that specific app is deleted when the app is deleted, which can help keep your environment clean.
@@ -618,4 +656,4 @@ These types of scenarios are explored in more depth in the [identities best prac
618
656
In this tutorial, you learned how to migrate an application to passwordless connections. You can read the following resources to explore the concepts discussed in this article in more depth:
619
657
620
658
* [Authorize access to blobs using Microsoft Entra ID](../blobs/authorize-access-azure-active-directory.md)
621
-
* To learn more about .NET Core, see [Get started with .NET in 10 minutes](https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/intro).
659
+
* To learn more about .NET, see [Get started with .NET in 10 minutes](https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/intro).
0 commit comments