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
+21-20Lines changed: 21 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,7 @@ For REST proxy endpoint requests, client applications should get an OAuth token.
69
69
You can use the python code below to interact with the REST proxy on your Kafka cluster. To use the code sample, follow these steps:
70
70
71
71
1. Save the sample code on a machine with Python installed.
72
-
1. Install required python dependencies by executing `pip3 install adal` and `pip install msrestazure`.
72
+
1. Install required python dependencies by executing `pip3 install msal`.
73
73
1. Modify the code section **Configure these properties** and update the following properties for your environment:
74
74
75
75
|Property |Description |
@@ -79,7 +79,7 @@ You can use the python code below to interact with the REST proxy on your Kafka
79
79
|Client Secret|The secret for the application that you registered in the security group.|
80
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
81
82
-
1. From the command line, execute the python file by executing `python <filename.py>`
82
+
1. From the command line, execute the python file by executing `sudo python3 <filename.py>`
83
83
84
84
This code does the following action:
85
85
@@ -90,13 +90,9 @@ For more information on getting OAuth tokens in python, see [Python Authenticati
90
90
91
91
```python
92
92
#Required python packages
93
-
#pip3 install adal
94
-
#pip install msrestazure
93
+
#pip3 install msal
95
94
96
-
import adal
97
-
from msrestazure.azure_active_directory import AdalAuthentication
98
-
from msrestazure.azure_cloud importAZURE_PUBLIC_CLOUD
99
-
import requests
95
+
import msal
100
96
101
97
#--------------------------Configure these properties-------------------------------#
Find below another sample on how to get a token from Azure for REST proxy using a curl command. Notice that we need the `resource=https://hib.azurehdinsight.net` specified while getting a token.
136
+
Find below another sample on how to get a token from Azure for REST proxy using a curl command. **Notice that we need the `scope=https://hib.azurehdinsight.net/.default` specified while getting a token.**
136
137
137
138
```cmd
138
-
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'client_id=<clientid>&client_secret=<clientsecret>&grant_type=client_credentials&resource=https://hib.azurehdinsight.net' 'https://login.microsoftonline.com/<tenantid>/oauth2/token'
139
+
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'client_id=<clientid>&client_secret=<clientsecret>&grant_type=client_credentials&scope=https://hib.azurehdinsight.net/.default' 'https://login.microsoftonline.com/<tenantid>/oauth2/v2.0/token'
0 commit comments