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
1. Enable a system-assigned managed identity for the virtual machine. For more information about configuring managed identity on a VM, see [Configure managed identities for Azure resources on a VM using the Azure portal](../active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vm.md#system-assigned-managed-identity). Managed identities for Azure resources provide Azure services with an automatically managed identity in Azure Active Directory. You can use this identity to authenticate to any service that supports Azure AD authentication, without having credentials in your code.
38
-
2. Using the **Access control** page of the Event Hubs namespace you created, assign **Azure Event Hubs Data Owner** role to the VM's managed identity.
38
+
39
+
:::image type="content" source="./media/event-hubs-quickstart-kafka-enabled-event-hubs/enable-identity-vm.png" alt-text="Screenshot of the Identity tab of a virtual machine page in the Azure portal.":::
40
+
1. Using the **Access control** page of the Event Hubs namespace you created, assign **Azure Event Hubs Data Owner** role to the VM's managed identity.
39
41
Azure Event Hubs supports using Azure Active Directory (Azure AD) to authorize requests to Event Hubs resources. With Azure AD, you can use Azure role-based access control (Azure RBAC) to grant permissions to a security principal, which may be a user, or an application service principal.
40
42
1. In the Azure portal, navigate to your Event Hubs namespace. Go to "Access Control (IAM)" in the left navigation.
41
43
2. Select + Add and select `Add role assignment`.
42
-
3. In the Role tab, select `Azure Event Hubs Data Owner` and select the Next button.
43
-
4. In the `Members` tab, select the `Managed Identity` radio button for type to assign access to.
44
-
5. Select the `+Select members` link. In the Managed Identity dropdown, select Virtual Machine and select your virtual machine's managed identity.
45
-
6. Select `Review + Assign`.
46
-
1. Log in to the VM for which you configured the managed identity, and clone the [Azure Event Hubs for Kafka repository](https://github.com/Azure/azure-event-hubs-for-kafka).
44
+
45
+
:::image type="content" source="./media/event-hubs-quickstart-kafka-enabled-event-hubs/add-role-assignment-menu.png" alt-text="Screenshot of the Access Control page of an Event Hubs namespace.":::
46
+
1. In the Role tab, select **Azure Event Hubs Data Owner**, and select the **Next** button.
47
+
48
+
:::image type="content" source="./media/event-hubs-quickstart-kafka-enabled-event-hubs/select-event-hubs-owner-role.png" alt-text="Screenshot showing the selection of the Azure Event Hubs Data Owner role.":::
49
+
1. In the **Members** tab, select the **Managed Identity** in the **Assign access to** section.
50
+
1. Select the **+Select members** link.
51
+
1. On the **Select managed identities** page, follow these steps:
52
+
1. Select the **Azure subscription** that has the VM.
53
+
1. For **Managed identity**, select **Virtual machine**
54
+
1. Select your virtual machine's managed identity.
55
+
1. Click **Select** at the bottom of the page.
56
+
57
+
:::image type="content" source="./media/event-hubs-quickstart-kafka-enabled-event-hubs/add-vm-identity.png" alt-text="Screenshot showing the Add role assignment -> Select managed identities page.":::
58
+
1. Select **Review + Assign**.
59
+
60
+
:::image type="content" source="./media/event-hubs-quickstart-kafka-enabled-event-hubs/add-vm-identity.png" alt-text="Screenshot showing the Add role assignment -> Select managed identities page.":::
61
+
1. Restart the VM and log in back to the VM for which you configured the managed identity.
62
+
1. Clone the [Azure Event Hubs for Kafka repository](https://github.com/Azure/azure-event-hubs-for-kafka).
47
63
1. Navigate to `azure-event-hubs-for-kafka/tutorials/oauth/java/managedidentity/consumer`.
48
-
6. Switch to the `src/main/resources/` folder, and open `consumer.config`. Replace `namespacename` with the name of your Event Hubs namespace.
64
+
1. Switch to the `src/main/resources/` folder, and open `consumer.config`. Replace `namespacename` with the name of your Event Hubs namespace.
@@ -57,13 +73,13 @@ Azure Event Hubs supports using Azure Active Directory (Azure AD) to authorize r
57
73
58
74
> [!NOTE]
59
75
> You can find all the OAuth samples for Event Hubs for Kafka [here](https://github.com/Azure/azure-event-hubs-for-kafka/tree/master/tutorials/oauth).
60
-
7. Run the consumer code and process events from event hub using your Kafka clients:
76
+
7. Switch back to the **Consumer** folder where the pom.xml file is and, and run the consumer code and process events from event hub using your Kafka clients:
61
77
62
78
```java
63
79
mvn clean package
64
80
mvn exec:java -Dexec.mainClass="TestConsumer"
65
81
```
66
-
1. Navigate to `azure-event-hubs-for-kafka/tutorials/oauth/java/managedidentity/producer`.
82
+
1. Launch another command prompt window, and navigate to `azure-event-hubs-for-kafka/tutorials/oauth/java/managedidentity/producer`.
67
83
1. Switch to the `src/main/resources/` folder, and open `producer.config`. Replace `mynamespace` with the name of your Event Hubs namespace.
68
84
4. Switch back to the **Producer** folder where the `pom.xml` file is and, run the producer code and stream events into Event Hubs:
69
85
@@ -74,6 +90,8 @@ Azure Event Hubs supports using Azure Active Directory (Azure AD) to authorize r
74
90
75
91
You should see messages about events sent in the producer window. Now, check the consumer app window to see the messages that it receives from the event hub.
76
92
93
+
:::image type="content" source="./media/event-hubs-quickstart-kafka-enabled-event-hubs/producer-consumer-output.png" alt-text="Screenshot showing the Producer and Consumer app windows showing the events.":::
94
+
77
95
### [Connection string](#tab/connection-string)
78
96
79
97
1. Clone the [Azure Event Hubs for Kafka repository](https://github.com/Azure/azure-event-hubs-for-kafka).
0 commit comments