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/hdinsight/kafka/rest-proxy.md
+28-23Lines changed: 28 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,37 @@
1
1
---
2
2
title: Apache Kafka REST proxy - Azure HDInsight
3
-
description: Learn how to perform Apache Kafka operations using a Kafka REST proxy on Azure HDInsight.
3
+
description: Learn how to do Apache Kafka operations using a Kafka REST proxy on Azure HDInsight.
4
4
author: hrasheed-msft
5
5
ms.author: hrasheed
6
6
ms.reviewer: hrasheed
7
7
ms.service: hdinsight
8
8
ms.topic: conceptual
9
-
ms.date: 04/01/2020
9
+
ms.date: 04/03/2020
10
10
---
11
+
11
12
# Interact with Apache Kafka clusters in Azure HDInsight using a REST proxy
12
13
13
-
Kafka REST Proxy enables you to interact with your Kafka cluster via a REST API over HTTP. This means that your Kafka clients can be outside of your virtual network. Additionally, clients can make simple HTTP calls to send and receive messages to the Kafka cluster, instead of relying on Kafka libraries. This tutorial will show you how to create a REST proxy enabled Kafka cluster and provide a sample code that shows how to make calls to REST proxy.
14
+
Kafka REST Proxy enables you to interact with your Kafka cluster via a REST API over HTTP. This action means that your Kafka clients can be outside of your virtual network. Clients can make simple HTTP calls to the Kafka cluster, instead of relying on Kafka libraries. This article will show you how to create a REST proxy enabled Kafka cluster. Also provides a sample code that shows how to make calls to REST proxy.
14
15
15
16
## REST API reference
16
17
17
-
For the full specification of operations supported by the Kafka REST API, see [HDInsight Kafka REST Proxy API Reference](https://docs.microsoft.com/rest/api/hdinsight-kafka-rest-proxy).
18
+
For operations supported by the Kafka REST API, see [HDInsight Kafka REST Proxy API Reference](https://docs.microsoft.com/rest/api/hdinsight-kafka-rest-proxy).
For the full specification of operations supported by the API, please see [Apache Kafka REST Proxy API](https://docs.microsoft.com/rest/api/hdinsight-kafka-rest-proxy).
24
+
For the full specification of operations supported by the API, see [Apache Kafka REST Proxy API](https://docs.microsoft.com/rest/api/hdinsight-kafka-rest-proxy).
24
25
25
26
### REST Proxy endpoint
26
27
27
-
Creating an HDInsight Kafka cluster with REST proxy creates a new public endpoint for your cluster, which you can find in your HDInsight cluster "Properties" on the Azure portal.
28
+
Creating an HDInsight Kafka cluster with REST proxy creates a new public endpoint for your cluster, which you can find in your HDInsight cluster **Properties** on the Azure portal.
28
29
29
30
### Security
30
31
31
-
Access to the Kafka REST proxy is managed with Azure Active Directory security groups. When creating the Kafka cluster with the REST proxy enabled, you'll provide the Azure Active Directory security group that should have access to the REST endpoint. The Kafka clients (applications) that need access to the REST proxy should be registered to this group by the group owner. The group owner can do this via the Portal or via PowerShell.
32
+
Access to the Kafka REST proxy is managed with Azure Active Directory security groups. When creating the Kafka cluster, provide the Azure AD security group with REST endpoint access. Kafka clients that need access to the REST proxy should be registered to this group by the group owner. The group owner can register via the Portal or via PowerShell.
32
33
33
-
Before making requests to the REST proxy endpoint, the client application should get an OAuth token to verify membership of the right security group. Find a [Client application sample](#client-application-sample) below that shows how to get an OAuth token. Once the client application has the OAuth token, they must pass that token in the HTTP request made to the REST proxy.
34
+
For REST proxy endpoint requests, client applications should get an OAuth token. The token is used to verify security group membership. Find a [Client application sample](#client-application-sample) below that shows how to get an OAuth token. The client application passes the OAuth tokenin the HTTP request to the REST proxy.
34
35
35
36
> [!NOTE]
36
37
> See [Manage app and resource access using Azure Active Directory groups](../../active-directory/fundamentals/active-directory-manage-groups.md), to learn more about AAD security groups. For more information on how OAuth tokens work, see [Authorize access to Azure Active Directory web applications using the OAuth 2.0 code grant flow](../../active-directory/develop/v1-protocols-oauth-code.md).
@@ -39,17 +40,17 @@ Before making requests to the REST proxy endpoint, the client application should
39
40
40
41
1. Register an application with Azure AD. The client applications that you write to interact with the Kafka REST proxy will use this application's ID and secret to authenticate to Azure.
41
42
42
-
1. Create an Azure AD security group and add the application that you've registered with Azure AD to the security group as a "member" of the group. This security group will be used to control which applications are allowed to interact with the REST proxy. For more information on creating Azure AD groups, see [Create a basic group and add members using Azure Active Directory](../../active-directory/fundamentals/active-directory-groups-create-azure-portal.md).
43
+
1. Create an Azure AD security group. Add the application that you've registered with Azure AD to the security group as a **member** of the group. This security group will be used to control which applications are allowed to interact with the REST proxy. For more information on creating Azure AD groups, see [Create a basic group and add members using Azure Active Directory](../../active-directory/fundamentals/active-directory-groups-create-azure-portal.md).
1. During the Kafka cluster creation workflow, in the "Security + networking" tab, check the "Enable Kafka REST proxy" option.
53
+
1. During the Kafka cluster creation workflow, in the **Security + networking** tab, check the **Enable Kafka REST proxy** option.
53
54
54
55

55
56
@@ -69,19 +70,23 @@ You can use the python code below to interact with the REST proxy on your Kafka
69
70
70
71
1. Save the sample code on a machine with Python installed.
71
72
1. Install required python dependencies by executing `pip3 install adal` and `pip install msrestazure`.
72
-
1. Modify the code section *Configure these properties* and update the following properties for your environment:
73
-
1.*Tenant ID* – The Azure tenant where your subscription is.
74
-
1.*Client ID* – The ID for the application that you registered in the security group.
75
-
1.*Client Secret* – The secret for the application that you registered in the security group
76
-
1.*Kafkarest_endpoint* – get this value from the "properties" tab in the cluster overview as described in the [deployment section](#create-a-kafka-cluster-with-rest-proxy-enabled). It should be in the following format – `https://<clustername>-kafkarest.azurehdinsight.net`
73
+
1. Modify the code section **Configure these properties** and update the following properties for your environment:
74
+
75
+
|Property |Description |
76
+
|---|---|
77
+
|Tenant ID|The Azure tenant where your subscription is.|
78
+
|Client ID|The ID for the application that you registered in the security group.|
79
+
|Client Secret|The secret for the application that you registered in the security group.|
80
+
|Kafkarest_endpoint|Get this value from the **Properties** tab in the cluster overview as described in the [deployment section](#create-a-kafka-cluster-with-rest-proxy-enabled). It should be in the following format – `https://<clustername>-kafkarest.azurehdinsight.net`|
81
+
77
82
1. From the command line, execute the python file by executing `python <filename.py>`
78
83
79
-
This code does the following:
84
+
This code does the following action:
80
85
81
-
1. Fetches an OAuth token from Azure AD
82
-
1. Shows how to make a request to Kafka REST proxy
86
+
1. Fetches an OAuth token from Azure AD.
87
+
1. Shows how to make a request to Kafka REST proxy.
83
88
84
-
For more information on getting OAuth tokens in python, see [Python AuthenticationContext class](https://docs.microsoft.com/python/api/adal/adal.authentication_context.authenticationcontext?view=azure-python). You might see a delay while topics that aren't created or deleted through the Kafka REST proxy are reflected there. This delay is due to cache refresh.
89
+
For more information on getting OAuth tokens in python, see [Python AuthenticationContext class](https://docs.microsoft.com/python/api/adal/adal.authentication_context.authenticationcontext?view=azure-python). You might see a delay while `topics` that aren't created or deleted through the Kafka REST proxy are reflected there. This delay is because of cache refresh.
0 commit comments