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/migrate-azure-credentials.md
+16-12Lines changed: 16 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,20 @@
2
2
title: Migrate applications to use passwordless authentication with Azure Storage
3
3
titleSuffix: Azure Storage
4
4
description: Learn to migrate existing applications away from Shared Key authorization with the account key to instead use Azure AD and Azure RBAC for enhanced security.
# Migrate an application to use passwordless connections with Azure services
@@ -20,7 +24,7 @@ Application requests to Azure Storage must be authenticated using either account
20
24
21
25
## Security risks associated with Shared Key authorization
22
26
23
-
The following code example demonstrates how to connect to Azure Storage using a storage account key. When you create a storage account, Azure generates access keys for that account. Many developers gravitate towards this solution because it feels familiar to options they have worked with in the past. For example, connection strings for storage accounts also use access keys as part of the string. If your application currently uses access keys, consider migrating to passwordless connections using the steps described later in this document.
27
+
The following code example demonstrates how to connect to Azure Storage using a storage account key. When you create a storage account, Azure generates access keys for that account. Many developers gravitate towards this solution because it feels familiar to options they have worked with in the past. For example, connection strings for storage accounts also use access keys as part of the string. If your application currently uses access keys, consider migrating to passwordless connections using the steps described later in this document.
24
28
25
29
```csharp
26
30
varblobServiceClient=newBlobServiceClient(
@@ -30,7 +34,7 @@ var blobServiceClient = new BlobServiceClient(
30
34
31
35
Storage account keys should be used with caution. Developers must be diligent to never expose the keys in an unsecure location. Anyone who gains access to the key is able to authenticate. For example, if an account key is accidentally checked into source control, sent through an unsecure email, pasted into the wrong chat, or viewed by someone who shouldn't have permission, there's risk of a malicious user accessing the application. Instead, consider updating your application to use passwordless connections.
32
36
33
-
## Migrating to passwordless connections
37
+
## Migrate to passwordless connections
34
38
35
39
Many Azure services support passwordless connections through Azure AD and Role Based Access control (RBAC). These techniques provide robust security features and can be implemented using `DefaultAzureCredential` from the Azure Identity client libraries.
36
40
@@ -135,11 +139,11 @@ For this migration guide you will use App Service, but the steps are similar on
135
139
136
140
Select **Next: Authentication**.
137
141
138
-
:::image type="content" source="media/migration-create-identity-small.png" alt-text="Screenshot showing how to create a system assigned managed identity." lightbox="media/migration-create-identity.png":::
142
+
:::image type="content" source="media/migration-create-identity-small.png" alt-text="Screenshot showing how to create a system assigned managed identity." lightbox="media/migration-create-identity.png":::
139
143
140
144
1. Make sure **System assigned managed identity (Recommended)** is selected, and then choose **Next: Networking**.
141
145
1. Leave the default values selected, and then choose **Next: Review + Create**.
142
-
1. After Azure validates your settings, click**Create**.
146
+
1. After Azure validates your settings, select**Create**.
143
147
144
148
The Service Connector will automatically create a system-assigned managed identity for the app service. The connector will also assign the managed identity a **Storage Blob Data Contributor** role for the storage account you selected.
145
149
@@ -289,15 +293,15 @@ If you connected your services using the Service Connector you do not need to co
289
293
290
294
1. Choose **Add role assignment**
291
295
292
-
:::image type="content" source="media/migration-add-role-small.png" alt-text="Screenshot showing how to add a role to a managed identity." lightbox="media/migration-add-role.png":::
296
+
:::image type="content" source="media/migration-add-role-small.png" alt-text="Screenshot showing how to add a role to a managed identity." lightbox="media/migration-add-role.png":::
293
297
294
298
1. In the **Role** search box, search for *Storage Blob Data Contributor*, which is a common role used to manage data operations for blobs. You can assign whatever role is appropriate for your use case. Select the *Storage Blob Data Contributor* from the list and choose **Next**.
295
299
296
300
1. On the **Add role assignment** screen, for the **Assign access to** option, select **Managed identity**. Then choose **+Select members**.
297
301
298
302
1. In the flyout, search for the managed identity you created by entering the name of your app service. Select the system assigned identity, and then choose **Select** to close the flyout menu.
299
303
300
-
:::image type="content" source="media/migration-select-identity-small.png" alt-text="Screenshot showing how to select the assigned managed identity." lightbox="media/migration-select-identity.png":::
304
+
:::image type="content" source="media/migration-select-identity-small.png" alt-text="Screenshot showing how to select the assigned managed identity." lightbox="media/migration-select-identity.png":::
301
305
302
306
1. Select **Next** a couple times until you're able to select **Review + assign** to finish the role assignment.
0 commit comments