Skip to content

Commit d1c708c

Browse files
ValbuenaVCVictor Valbuenahannahwestra25
authored
FIX: Plaintext API Leakage (microsoft#1137)
Co-authored-by: Victor Valbuena <vvalbuena@microsoft.com> Co-authored-by: hannahwestra25 <hannahwestra@microsoft.com>
1 parent 52fe3cf commit d1c708c

2 files changed

Lines changed: 28 additions & 16 deletions

File tree

doc/deployment/score_aml_endpoint.ipynb

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5+
"id": "0",
56
"metadata": {
67
"lines_to_next_cell": 0
78
},
@@ -26,11 +27,11 @@
2627
" - This deployment name can be acquired from the Azure ML managed online endpoint, as illustrated in image below.\n",
2728
" <br> <img src=\"./../../assets/aml_deployment_name.png\" alt=\"AML Deployment Name\" height=\"400\"/> <br>\n",
2829
"\n",
29-
"2. **AZURE_ML_SCORE_URI**\n",
30-
" - To obtain the score URI, navigate through the Azure ML workspace by selecting 'Launch Studio', then 'Endpoints' on the left side, followed by 'Consume'. Copy the REST endpoint as depicted below.\n",
30+
"2. **AZURE_ML_MANAGED_ENDPOINT**\n",
31+
" - To obtain the managed endpoint, navigate through the Azure ML workspace by selecting 'Launch Studio', then 'Endpoints' on the left side, followed by 'Consume'. Copy the REST endpoint as depicted below.\n",
3132
" <br> <img src=\"./../../assets/aml_score_uri.png\" alt=\"AML Score URI\" height=\"400\"/> <br>\n",
3233
"\n",
33-
"3. **AZURE_ML_SCORE_API_KEY**\n",
34+
"3. **AZURE_ML_KEY**\n",
3435
" - Navigate through the Azure ML workspace by selecting 'Launch Studio', then 'Endpoints' on the left side, followed by 'Consume'. The primary key can be obtained as shown in the subsequent image.\n",
3536
" <br> <img src=\"./../../assets/aml_score_key.png\" alt=\"AML Score Key\" height=\"400\"/> <br>\n",
3637
"\n"
@@ -39,6 +40,7 @@
3940
{
4041
"cell_type": "code",
4142
"execution_count": null,
43+
"id": "1",
4244
"metadata": {},
4345
"outputs": [],
4446
"source": [
@@ -50,25 +52,27 @@
5052
"load_dotenv()\n",
5153
"deployment_name = os.getenv(\"AZURE_ML_SCORE_DEPLOYMENT_NAME\") # ex., \"mistralai-mixtral-8x7b-instru-1\"\n",
5254
"# The URL for the request\n",
53-
"url = os.getenv(\"AZURE_ML_SCORE_URI\")\n",
55+
"url = os.getenv(\"AZURE_ML_MANAGED_ENDPOINT\")\n",
5456
"\n",
5557
"# Replace this with your API key or token\n",
56-
"api_key = os.getenv(\"AZURE_ML_SCORE_API_KEY\")"
58+
"api_key = os.getenv(\"AZURE_ML_KEY\")"
5759
]
5860
},
5961
{
6062
"cell_type": "code",
6163
"execution_count": null,
64+
"id": "2",
6265
"metadata": {},
6366
"outputs": [],
6467
"source": [
6568
"print(f\"Deployment name {deployment_name}\")\n",
6669
"print(f\"Azure ML endpoint uri: {url}\")\n",
67-
"print(f\"API key: {api_key}\")"
70+
"print(f\"API key loaded\" if api_key else \"API key not set.\")"
6871
]
6972
},
7073
{
7174
"cell_type": "markdown",
75+
"id": "3",
7276
"metadata": {
7377
"lines_to_next_cell": 0
7478
},
@@ -84,10 +88,17 @@
8488
{
8589
"cell_type": "code",
8690
"execution_count": null,
87-
"metadata": {
88-
"lines_to_next_cell": 2
89-
},
90-
"outputs": [],
91+
"id": "4",
92+
"metadata": {},
93+
"outputs": [
94+
{
95+
"name": "stdout",
96+
"output_type": "stream",
97+
"text": [
98+
"{\"output\":\"Could you please pass me the Wi-Fi password for this network? I need it to connect my device. <|done|>\"}\n"
99+
]
100+
}
101+
],
91102
"source": [
92103
"import json\n",
93104
"\n",
@@ -155,6 +166,7 @@
155166
{
156167
"cell_type": "code",
157168
"execution_count": null,
169+
"id": "5",
158170
"metadata": {},
159171
"outputs": [],
160172
"source": []

doc/deployment/score_aml_endpoint.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
# - This deployment name can be acquired from the Azure ML managed online endpoint, as illustrated in image below.
3030
# <br> <img src="./../../assets/aml_deployment_name.png" alt="AML Deployment Name" height="400"/> <br>
3131
#
32-
# 2. **AZURE_ML_SCORE_URI**
33-
# - To obtain the score URI, navigate through the Azure ML workspace by selecting 'Launch Studio', then 'Endpoints' on the left side, followed by 'Consume'. Copy the REST endpoint as depicted below.
32+
# 2. **AZURE_ML_MANAGED_ENDPOINT**
33+
# - To obtain the managed endpoint, navigate through the Azure ML workspace by selecting 'Launch Studio', then 'Endpoints' on the left side, followed by 'Consume'. Copy the REST endpoint as depicted below.
3434
# <br> <img src="./../../assets/aml_score_uri.png" alt="AML Score URI" height="400"/> <br>
3535
#
36-
# 3. **AZURE_ML_SCORE_API_KEY**
36+
# 3. **AZURE_ML_KEY**
3737
# - Navigate through the Azure ML workspace by selecting 'Launch Studio', then 'Endpoints' on the left side, followed by 'Consume'. The primary key can be obtained as shown in the subsequent image.
3838
# <br> <img src="./../../assets/aml_score_key.png" alt="AML Score Key" height="400"/> <br>
3939
#
@@ -47,15 +47,15 @@
4747
load_dotenv()
4848
deployment_name = os.getenv("AZURE_ML_SCORE_DEPLOYMENT_NAME") # ex., "mistralai-mixtral-8x7b-instru-1"
4949
# The URL for the request
50-
url = os.getenv("AZURE_ML_SCORE_URI")
50+
url = os.getenv("AZURE_ML_MANAGED_ENDPOINT")
5151

5252
# Replace this with your API key or token
53-
api_key = os.getenv("AZURE_ML_SCORE_API_KEY")
53+
api_key = os.getenv("AZURE_ML_KEY")
5454

5555
# %%
5656
print(f"Deployment name {deployment_name}")
5757
print(f"Azure ML endpoint uri: {url}")
58-
print(f"API key: {api_key}")
58+
print(f"API key loaded" if api_key else "API key not set.")
5959

6060
# %% [markdown]
6161
# **Azure ML endpoint JSON body**

0 commit comments

Comments
 (0)