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/service-bus-messaging/service-bus-migrate-azure-credentials.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Migrate applications to use passwordless authentication with Azure Service Bus
3
3
titleSuffix: Azure Service Bus
4
-
description: Learn to migrate existing service bus applications away from connection strings to use Azure AD and Azure RBAC for enhanced security.
4
+
description: Learn to migrate existing Service Bus applications away from connection strings to use Azure AD and Azure RBAC for enhanced security.
5
5
author: alexwolfmsft
6
6
ms.author: alexwolf
7
7
ms.reviewer: randolphwest
@@ -22,9 +22,9 @@ ms.devlang: csharp
22
22
23
23
Application requests to Azure Service Bus must be authenticated using either account access keys or passwordless connections. However, you should prioritize passwordless connections in your applications when possible. This tutorial explores how to migrate from traditional authentication methods to more secure, passwordless connections.
24
24
25
-
## Security risks associated with connection strings
25
+
## Security risks associated with access keys
26
26
27
-
The following code example demonstrates how to connect to Azure Service Bus using a connection string. When you create a Service Bus Namespace, Azure generates connection strings automatically. Many developers gravitate towards this solution because it feels familiar to options they have worked with in the past. If your application currently uses connection strings, consider migrating to passwordless connections using the steps described later in this document.
27
+
The following code example demonstrates how to connect to Azure Service Bus using a connection string that includes an access key. When you create a Service Bus, Azure generates these keys and connection strings automatically. Many developers gravitate towards this solution because it feels familiar to options they have worked with in the past. If your application currently uses connection strings, consider migrating to passwordless connections using the steps described in this document.
@@ -46,7 +46,7 @@ The following steps explain how to migrate an existing application to use passwo
46
46
47
47
### Sign-in and migrate the app code to use passwordless connections
48
48
49
-
For local development, make sure you're authenticated with the same Azure AD account you assigned the role to for the service bus namespace. You can authenticate via the Azure CLI, Visual Studio, Azure PowerShell, or other tools such as IntelliJ.
49
+
For local development, make sure you're authenticated with the same Azure AD account you assigned the role to for the Service Bus namespace. You can authenticate via the Azure CLI, Visual Studio, Azure PowerShell, or other tools such as IntelliJ.
1. Make sure to update the service bus namespace in the URI of your `ServiceBusClient`. You can find the namespace on the overview page of the Azure portal.
82
+
1. Make sure to update the Service Bus namespace in the URI of your `ServiceBusClient`. You can find the namespace on the overview page of the Azure portal.
83
83
84
84
#### Run the app locally
85
85
@@ -189,19 +189,19 @@ az vm identity assign \
189
189
190
190
#### Assign roles to the managed identity
191
191
192
-
Next, you need to grant permissions to the managed identity you created to access your service bus. You can do this by assigning a role to the managed identity, just like you did with your local development user.
192
+
Next, you need to grant permissions to the managed identity you created to access your Service Bus. You can do this by assigning a role to the managed identity, just like you did with your local development user.
If you connected your services using the Service Connector you do not need to complete this step. The necessary configurations were handled for you:
197
197
198
-
* If you selected a managed identity while creating the connection, a system-assigned managed identity was created for your app and assigned the **Azure Service Bus Data Owner** role on the service bus.
198
+
* If you selected a managed identity while creating the connection, a system-assigned managed identity was created for your app and assigned the **Azure Service Bus Data Owner** role on the Service Bus.
199
199
200
200
* If you selected connection string, the connection string was added as an app environment variable.
201
201
202
202
### [Azure portal](#tab/assign-role-azure-portal)
203
203
204
-
1. Navigate to your service bus overview page and select **Access Control (IAM)** from the left navigation.
204
+
1. Navigate to your Service Bus overview page and select **Access Control (IAM)** from the left navigation.
205
205
206
206
1. Choose **Add role assignment**
207
207
@@ -241,7 +241,7 @@ az role assignment create \
241
241
242
242
#### Test the app
243
243
244
-
After making these code changes, browse to your hosted application in the browser. Your app should be able to connect to the service bus successfully. Keep in mind that it may take several minutes for the role assignments to propagate through your Azure environment. Your application is now configured to run both locally and in a production environment without the developers having to manage secrets in the application itself.
244
+
After making these code changes, browse to your hosted application in the browser. Your app should be able to connect to the Service Bus successfully. Keep in mind that it may take several minutes for the role assignments to propagate through your Azure environment. Your application is now configured to run both locally and in a production environment without the developers having to manage secrets in the application itself.
Copy file name to clipboardExpand all lines: includes/passwordless/migration-guide/create-managed-identity-portal.md
+4-8Lines changed: 4 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,6 @@ The following steps demonstrate how to create a system-assigned managed identity
4
4
5
5
Some app hosting environments support Service Connector, which helps you connect Azure compute services to other backing services. Service Connector automatically configures network settings and connection information. You can learn more about Service Connector and which scenarios are supported on the [overview page](../../../service-connector/overview.md).
6
6
7
-
8
-
9
7
The following compute services are currently supported:
10
8
11
9
* Azure App Service
@@ -28,13 +26,11 @@ For this migration guide you will use App Service, but the steps are similar on
28
26
29
27
Select **Next: Authentication**.
30
28
31
-
:::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":::
32
-
33
29
1. Make sure **System assigned managed identity (Recommended)** is selected, and then choose **Next: Networking**.
34
30
1. Leave the default values selected, and then choose **Next: Review + Create**.
35
31
1. After Azure validates your settings, select **Create**.
36
32
37
-
The Service Connector will automatically create a system-assigned managed identity for the app service. The connector will also assign the managed identity a **Service Bus Data Owner** role for the service bus you selected.
33
+
The Service Connector will automatically create a system-assigned managed identity for the app service. The connector will also assign the managed identity a **Azure Service Bus Data Owner** role for the service bus you selected.
38
34
39
35
### [Azure App Service](#tab/app-service)
40
36
@@ -49,22 +45,22 @@ The Service Connector will automatically create a system-assigned managed identi
49
45
50
46
1. Under the **System assigned** tab, make sure to set the **Status** field to **on**. A system assigned identity is managed by Azure internally and handles administrative tasks for you. The details and IDs of the identity are never exposed in your code.
51
47
52
-
:::image type="content" source="../media/storage-migrate-credentials/spring-apps-identity.png" alt-text="Screenshot showing how to enable managed identity for Azure Spring Apps.":::
48
+
:::image type="content" source="../media/spring-apps-identity.png" alt-text="Screenshot showing how to enable managed identity for Azure Spring Apps.":::
53
49
54
50
### [Azure Container Apps](#tab/container-apps)
55
51
56
52
1. On the main overview page of your Azure Container Apps instance, select **Identity** from the left navigation.
57
53
58
54
1. Under the **System assigned** tab, make sure to set the **Status** field to **on**. A system assigned identity is managed by Azure internally and handles administrative tasks for you. The details and IDs of the identity are never exposed in your code.
59
55
60
-
:::image type="content" source="../media/storage-migrate-credentials/container-apps-identity.png" alt-text="Screenshot showing how to enable managed identity for Azure Container Apps.":::
56
+
:::image type="content" source="../media/container-apps-identity.png" alt-text="Screenshot showing how to enable managed identity for Azure Container Apps.":::
1. On the main overview page of your virtual machine, select **Identity** from the left navigation.
65
61
66
62
1. Under the **System assigned** tab, make sure to set the **Status** field to **on**. A system assigned identity is managed by Azure internally and handles administrative tasks for you. The details and IDs of the identity are never exposed in your code.
67
63
68
-
:::image type="content" source="../media/storage-migrate-credentials/virtual-machine-identity.png" alt-text="Screenshot showing how to enable managed identity for virtual machines.":::
64
+
:::image type="content" source="../media/virtual-machine-identity.png" alt-text="Screenshot showing how to enable managed identity for virtual machines.":::
Copy file name to clipboardExpand all lines: includes/passwordless/migration-guide/migrate-to-passwordless-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ Many Azure services support passwordless connections through Azure AD and Role B
5
5
6
6
`DefaultAzureCredential` supports multiple authentication methods and automatically determines which should be used at runtime. This approach enables your app to use different authentication methods in different environments (local dev vs. production) without implementing environment-specific code.
7
7
8
-
The order and locations in which `DefaultAzureCredential` searches for credentials can be found in the [Azure Identity library overview](/dotnet/api/overview/azure/Identity-readme#defaultazurecredential) and varies between languages. For example, when working locally with .NET, `DefaultAzureCredential` will generally authenticate using the account the developer used to sign-in to Visual Studio. When the app is deployed to Azure, `DefaultAzureCredential` will automatically switch to use a[managed identity](../../active-directory/managed-identities-azure-resources/overview.md). No code changes are required for this transition.
8
+
The order and locations in which `DefaultAzureCredential` searches for credentials can be found in the [Azure Identity library overview](/dotnet/api/overview/azure/Identity-readme#defaultazurecredential) and varies between languages. For example, when working locally with .NET, `DefaultAzureCredential` will generally authenticate using the account the developer used to sign-in to the Azure CLI or Visual Studio. When the app is deployed to Azure, `DefaultAzureCredential` will automatically discover and use the[managed identity](../../active-directory/managed-identities-azure-resources/overview.md) of the associated hosting service, such as Azure App Service. No code changes are required for this transition.
9
9
10
10
> [!NOTE]
11
11
> A managed identity provides a security identity to represent an app or service. The identity is managed by the Azure platform and does not require you to provision or rotate any secrets. You can read more about managed identities in the [overview](../../active-directory/managed-identities-azure-resources/overview.md) documentation.
Copy file name to clipboardExpand all lines: includes/passwordless/service-bus/service-bus-assign-roles-tabbed.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,20 +10,20 @@ ms.author: alexwolf
10
10
ms.custom: include file
11
11
---
12
12
13
-
When developing locally, make sure that the user account that is accessing blob data has the correct permissions. You'll need **Azure Service Bus Data Owner** to read and write blob data. To assign yourself this role, you'll need to be assigned the **User Access Administrator** role, or another role that includes the **Microsoft.Authorization/roleAssignments/write** action. You can assign Azure RBAC roles to a user using the Azure portal, Azure CLI, or Azure PowerShell. You can learn more about the available scopes for role assignments on the [scope overview](../articles/role-based-access-control/scope-overview.md) page.
13
+
When developing locally, make sure that the user account that is accessing Service Bus has the correct permissions. You'll need **Azure Service Bus Data Owner** to send and receive data. To assign yourself this role, you'll need to be assigned the **User Access Administrator** role, or another role that includes the **Microsoft.Authorization/roleAssignments/write** action. You can assign Azure RBAC roles to a user using the Azure portal, Azure CLI, or Azure PowerShell. You can learn more about the available scopes for role assignments on the [scope overview](../articles/role-based-access-control/scope-overview.md) page.
14
14
15
-
In this scenario, you'll assign permissions to your user account, scoped to the service bus, to follow the [Principle of Least Privilege](../articles/active-directory/develop/secure-least-privileged-access.md). This practice gives users only the minimum permissions needed and creates more secure production environments.
15
+
In this scenario, you'll assign permissions to your user account scoped to a specific Service Bus namespace, to follow the [Principle of Least Privilege](../articles/active-directory/develop/secure-least-privileged-access.md). This practice gives users only the minimum permissions needed and creates more secure production environments.
16
16
17
-
The following example will assign the **Azure Service Bus Data Owner** role to your user account, which provides both read and write access to blob data in your service bus.
17
+
The following example will assign the **Azure Service Bus Data Owner** role to your user account, which allows you to send and receive data.
18
18
19
19
> [!IMPORTANT]
20
20
> In most cases it will take a minute or two for the role assignment to propagate in Azure, but in rare cases it may take up to eight minutes. If you receive authentication errors when you first run your code, wait a few moments and try again.
21
21
22
22
### [Azure portal](#tab/roles-azure-portal)
23
23
24
-
1. In the Azure portal, locate your service bus using the main search bar or left navigation.
24
+
1. In the Azure portal, locate your Service Bus namespace using the main search bar or left navigation.
25
25
26
-
2. On the service bus overview page, select **Access control (IAM)** from the left-hand menu.
26
+
2. On the Service Bus overview page, select **Access control (IAM)** from the left-hand menu.
27
27
28
28
3. On the **Access control (IAM)** page, select the **Role assignments** tab.
0 commit comments