Skip to content

Commit 48d368a

Browse files
authored
Merge pull request #1 from Azure-Samples/creds
Change credentials approach
2 parents 57d0489 + b9cef8b commit 48d368a

File tree

9 files changed

+1116
-1097
lines changed

9 files changed

+1116
-1097
lines changed

.env.sample

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
AZURE_OPENAI_SERVICE="SERVICE-NAME"
2+
AZURE_OPENAI_DEPLOYMENT_NAME=DEPLOYMENT-NAME
3+
AZURE_OPENAI_ADA_DEPLOYMENT=ADA-DEPLOYMENT
4+
AZURE_SEARCH_SERVICE=SEARCH-SERVICE-NAME
5+
AZURE_COMPUTERVISION_SERVICE=COMPUTERVISION-SERVICE-NAME
6+
AZURE_TENANT_ID=TENANT-ID

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,26 @@ This repository contains many notebooks that explain how Azure AI Search works,
66

77
1. Run `azd up` on [azure-search-openai-demo](https://github.com/Azure-Samples/azure-search-openai-demo/) with GPT-4-vision enabled. This will create the necessary resources for the Azure OpenAI, Azure AI Search services, and the Computer Vision service.
88

9-
2. Create a .env with these variables, and the values taken from `.azure/ENV-NAME/.env`
9+
2. Create a .env with these variables, with the values taken from `.azure/ENV-NAME/.env` in the azure-search-openai-demo repository.
1010

1111
```shell
1212
AZURE_OPENAI_SERVICE=YOUR-SERVICE-NAME
1313
AZURE_OPENAI_DEPLOYMENT_NAME=YOUR-OPENAI-DEPLOYMENT-NAME
1414
AZURE_OPENAI_ADA_DEPLOYMENT=YOUR-EMBED-DEPLOYMENT-NAME
1515
AZURE_SEARCH_SERVICE=YOUR-SEARCH-SERVICE-NAME
1616
AZURE_COMPUTERVISION_SERVICE=YOUR-COMPUTERVISION-SERVICE-NAME
17+
AZURE_TENANT_ID=YOUR-TENANT-ID
1718
```
1819

19-
3. Login to your Azure account using either the Azure CLI or the Azure Developer CLI:
20+
3. Login to your Azure account using the Azure CLI. Specify `--tenant-id` if you deployed that repo to a non-default tenant.
2021

2122
```shell
2223
azd auth login
2324
```
2425

25-
4. If you deployed your resource group to a tenant other than your home tenant, set the tenant ID:
26+
4. Create a Python virtual environment or open the project in a container.
2627

27-
```shell
28-
export TENANT_ID=YOUR-TENANT-ID
29-
```
30-
31-
5. Create a Python virtual environment or open the project in a container.
32-
33-
6. Install the requirements:
28+
5. Install the requirements:
3429

3530
```shell
3631
pip install -r requirements.txt

azure_ai_search.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
"execution_count": 3,
19+
"execution_count": 1,
2020
"metadata": {},
2121
"outputs": [],
2222
"source": [
@@ -31,7 +31,7 @@
3131
"AZURE_SEARCH_SERVICE = os.getenv(\"AZURE_SEARCH_SERVICE\")\n",
3232
"AZURE_SEARCH_ENDPOINT = f\"https://{AZURE_SEARCH_SERVICE}.search.windows.net\"\n",
3333
"\n",
34-
"azure_credential = azure.identity.DefaultAzureCredential()\n",
34+
"azure_credential = azure.identity.AzureDeveloperCliCredential(tenant_id=os.getenv(\"AZURE_TENANT_ID\"))\n",
3535
"index_client = SearchIndexClient(endpoint=AZURE_SEARCH_ENDPOINT, credential=azure_credential)"
3636
]
3737
},
@@ -46,16 +46,16 @@
4646
},
4747
{
4848
"cell_type": "code",
49-
"execution_count": 5,
49+
"execution_count": 2,
5050
"metadata": {},
5151
"outputs": [
5252
{
5353
"data": {
5454
"text/plain": [
55-
"<azure.search.documents.indexes.models._index.SearchIndex at 0x114201090>"
55+
"<azure.search.documents.indexes.models._index.SearchIndex at 0x138703b90>"
5656
]
5757
},
58-
"execution_count": 5,
58+
"execution_count": 2,
5959
"metadata": {},
6060
"output_type": "execute_result"
6161
}

image_search.ipynb

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": 4,
12+
"execution_count": 10,
1313
"metadata": {},
1414
"outputs": [],
1515
"source": [
1616
"import os\n",
1717
"\n",
1818
"import dotenv\n",
19-
"from azure.identity import DefaultAzureCredential, get_bearer_token_provider\n",
19+
"from azure.identity import AzureDeveloperCliCredential, get_bearer_token_provider\n",
2020
"from azure.search.documents import SearchClient\n",
2121
"from azure.search.documents.indexes import SearchIndexClient\n",
2222
"from azure.search.documents.indexes.models import (\n",
@@ -36,8 +36,8 @@
3636
"\n",
3737
"AZURE_SEARCH_SERVICE = os.getenv(\"AZURE_SEARCH_SERVICE\")\n",
3838
"AZURE_SEARCH_ENDPOINT = f\"https://{AZURE_SEARCH_SERVICE}.search.windows.net\"\n",
39-
"AZURE_SEARCH_IMAGES_INDEX = \"images-index\"\n",
40-
"azure_credential = DefaultAzureCredential()\n",
39+
"AZURE_SEARCH_IMAGES_INDEX = \"images-index4\"\n",
40+
"azure_credential = AzureDeveloperCliCredential(tenant_id=os.getenv(\"AZURE_TENANT_ID\"))\n",
4141
"search_client = SearchClient(AZURE_SEARCH_ENDPOINT, AZURE_SEARCH_IMAGES_INDEX, credential=azure_credential)"
4242
]
4343
},
@@ -50,16 +50,16 @@
5050
},
5151
{
5252
"cell_type": "code",
53-
"execution_count": 5,
53+
"execution_count": 11,
5454
"metadata": {},
5555
"outputs": [
5656
{
5757
"data": {
5858
"text/plain": [
59-
"<azure.search.documents.indexes.models._index.SearchIndex at 0x120d3efd0>"
59+
"<azure.search.documents.indexes.models._index.SearchIndex at 0x12c3ba910>"
6060
]
6161
},
62-
"execution_count": 5,
62+
"execution_count": 11,
6363
"metadata": {},
6464
"output_type": "execute_result"
6565
}
@@ -99,7 +99,7 @@
9999
},
100100
{
101101
"cell_type": "code",
102-
"execution_count": 6,
102+
"execution_count": 13,
103103
"metadata": {},
104104
"outputs": [],
105105
"source": [
@@ -124,7 +124,6 @@
124124
" url = f\"{AZURE_COMPUTER_VISION_URL}:vectorizeImage\"\n",
125125
" headers = get_auth_headers()\n",
126126
" headers[\"Content-Type\"] = mimetype\n",
127-
" # add error checking\n",
128127
" response = requests.post(url, headers=headers, params=get_model_params(), data=open(image_file, \"rb\"))\n",
129128
" if response.status_code != 200:\n",
130129
" print(image_file, response.status_code, response.json())\n",
@@ -145,7 +144,7 @@
145144
},
146145
{
147146
"cell_type": "code",
148-
"execution_count": 7,
147+
"execution_count": 14,
149148
"metadata": {},
150149
"outputs": [],
151150
"source": [
@@ -166,7 +165,7 @@
166165
},
167166
{
168167
"cell_type": "code",
169-
"execution_count": 8,
168+
"execution_count": 15,
170169
"metadata": {},
171170
"outputs": [
172171
{
@@ -177,7 +176,7 @@
177176
"<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=640x451>"
178177
]
179178
},
180-
"execution_count": 8,
179+
"execution_count": 15,
181180
"metadata": {},
182181
"output_type": "execute_result"
183182
}
@@ -189,7 +188,7 @@
189188
},
190189
{
191190
"cell_type": "code",
192-
"execution_count": 9,
191+
"execution_count": 16,
193192
"metadata": {},
194193
"outputs": [
195194
{
@@ -213,7 +212,7 @@
213212
},
214213
{
215214
"cell_type": "code",
216-
"execution_count": 10,
215+
"execution_count": 17,
217216
"metadata": {},
218217
"outputs": [
219218
{
@@ -224,7 +223,7 @@
224223
"<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=640x433>"
225224
]
226225
},
227-
"execution_count": 10,
226+
"execution_count": 17,
228227
"metadata": {},
229228
"output_type": "execute_result"
230229
}
@@ -235,7 +234,7 @@
235234
},
236235
{
237236
"cell_type": "code",
238-
"execution_count": 11,
237+
"execution_count": 18,
239238
"metadata": {},
240239
"outputs": [
241240
{
@@ -259,7 +258,7 @@
259258
},
260259
{
261260
"cell_type": "code",
262-
"execution_count": 12,
261+
"execution_count": 19,
263262
"metadata": {},
264263
"outputs": [
265264
{
@@ -270,7 +269,7 @@
270269
"<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=640x404>"
271270
]
272271
},
273-
"execution_count": 12,
272+
"execution_count": 19,
274273
"metadata": {},
275274
"output_type": "execute_result"
276275
}

rag.ipynb

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
"execution_count": 2,
19+
"execution_count": 1,
2020
"metadata": {},
2121
"outputs": [],
2222
"source": [
@@ -30,7 +30,7 @@
3030
"\n",
3131
"dotenv.load_dotenv()\n",
3232
"\n",
33-
"azure_credential = azure.identity.DefaultAzureCredential()\n",
33+
"azure_credential = azure.identity.AzureDeveloperCliCredential(tenant_id=os.getenv(\"AZURE_TENANT_ID\"))\n",
3434
"\n",
3535
"# Initialize Azure OpenAI client\n",
3636
"AZURE_OPENAI_SERVICE = os.getenv(\"AZURE_OPENAI_SERVICE\")\n",
@@ -63,7 +63,7 @@
6363
},
6464
{
6565
"cell_type": "code",
66-
"execution_count": 3,
66+
"execution_count": 2,
6767
"metadata": {},
6868
"outputs": [],
6969
"source": [
@@ -84,14 +84,19 @@
8484
},
8585
{
8686
"cell_type": "code",
87-
"execution_count": 4,
87+
"execution_count": 3,
8888
"metadata": {},
8989
"outputs": [
9090
{
9191
"name": "stdout",
9292
"output_type": "stream",
9393
"text": [
94-
"[role_library.pdf#page=29]: The Manager of Product Management will collaborate with internal teams, such as engineering, sales, marketing, and finance, as well as external partners, suppliers, and customers to ensure successful product execution.\n",
94+
"[role_library-28.png]: · Knowledge of industry trends, technologies, and regulations.\n",
95+
"· Excellent communication and presentation skills.\n",
96+
"Manager of Product Management\n",
97+
"Job Title: Manager of Product Management, Contoso Electronics\n",
98+
"Job Summary:\n",
99+
"The Manager of Product Management is responsible for overseeing the product management team, driving product development and marketing strategy for Contoso Electronics. This individual will be accountable for the successful launch of new products and the implementation of product life-cycle management processes. The Manager of Product Management will collaborate with internal teams, such as engineering, sales, marketing, and finance, as well as external partners, suppliers, and customers to ensure successful product execution.\n",
95100
"Responsibilities:\n",
96101
"· Lead the product management team and provide guidance on product strategy, design, development, and launch.\n",
97102
"· Develop and implement product life-cycle management processes.\n",
@@ -107,9 +112,33 @@
107112
"· Bachelor's degree in business, engineering, or a related field.\n",
108113
"· At least 5 years of experience in product management.\n",
109114
"· Proven track record of successful product launches.\n",
115+
"· Strong understanding of product life-cycle management processes.\n",
116+
"· Excellent project management, organizational, and communication skills.\n",
117+
". Ability to work collaboratively with internal and external teams.\n",
118+
"· Ability to analyze customer feedback and identify areas for improvement.\n",
119+
"· Experience with market research, product marketing, and pricing strategies.\n",
120+
"· Knowledge of budgeting and cost models.\n",
110121
"\n",
111122
"\n",
112-
"[role_library.pdf#page=28]: \n",
123+
"[role_library-28.png]: The Manager of Product Management will collaborate with internal teams, such as engineering, sales, marketing, and finance, as well as external partners, suppliers, and customers to ensure successful product execution.\n",
124+
"Responsibilities:\n",
125+
"· Lead the product management team and provide guidance on product strategy, design, development, and launch.\n",
126+
"· Develop and implement product life-cycle management processes.\n",
127+
"· Monitor and analyze industry trends to identify opportunities for new products.\n",
128+
"· Develop product marketing plans and go-to-market strategies.\n",
129+
"· Research customer needs and develop customer-centric product roadmaps.\n",
130+
"· Collaborate with internal teams to ensure product execution and successful launch.\n",
131+
"· Develop pricing strategies and cost models.\n",
132+
"· Oversee product portfolio and performance metrics.\n",
133+
"· Manage product development budget.\n",
134+
"· Analyze product performance and customer feedback to identify areas for improvement.\n",
135+
"Qualifications:\n",
136+
"· Bachelor's degree in business, engineering, or a related field.\n",
137+
"· At least 5 years of experience in product management.\n",
138+
"· Proven track record of successful product launches.\n",
139+
"\n",
140+
"\n",
141+
"[role_library-27.png]: \n",
113142
"· 7+ years of experience in research and development in the electronics sector.\n",
114143
"· Proven track record of successfully designing, testing, and optimizing products.\n",
115144
"· Experience leading a team of researchers and engineers.\n",
@@ -122,7 +151,7 @@
122151
"The Manager of Product Management is responsible for overseeing the product management team, driving product development and marketing strategy for Contoso Electronics. This individual will be accountable for the successful launch of new products and the implementation of product life-cycle management processes. The Manager of Product Management will collaborate with internal teams, such as engineering, sales, marketing, and finance, as well as external partners, suppliers, and customers to ensure successful product execution.\n",
123152
"\n",
124153
"\n",
125-
"[role_library.pdf#page=23]: Company: Contoso Electronics\n",
154+
"[role_library-22.png]: Company: Contoso Electronics\n",
126155
"Location: Anywhere\n",
127156
"Job Type: Full-Time\n",
128157
"Salary: Competitive, commensurate with experience\n",
@@ -138,7 +167,7 @@
138167
"· Establish and maintain relationships with key customers, partners, and vendors.\n",
139168
"\n",
140169
"\n",
141-
"[role_library.pdf#page=11]: \n",
170+
"[role_library-10.png]: \n",
142171
"· Proven track record of successful product launches.\n",
143172
"· Excellent organizational and project management skills.\n",
144173
"· Ability to work independently and effectively in a fast-paced environment.\n",
@@ -155,22 +184,6 @@
155184
"Responsibilities:\n",
156185
"· Lead and manage the product management team, including setting team goals and objectives, hiring, training, and developing team members, and evaluating performance\n",
157186
"· Develop and \n",
158-
"\n",
159-
"\n",
160-
"[role_library.pdf#page=12]: \n",
161-
"Responsibilities:\n",
162-
"· Lead and manage the product management team, including setting team goals and objectives, hiring, training, and developing team members, and evaluating performance\n",
163-
"· Develop and maintain a long-term product strategy, roadmap and vision for Contoso Electronics products\n",
164-
"· Drive product innovation, identify new product opportunities, and assess market and customer needs\n",
165-
". Act as the primary liaison between the business and technical teams, ensuring that product plans are translated into successful products\n",
166-
". Manage the product life cycle from concept through product launch and post-launch support\n",
167-
"· Ensure product quality and customer satisfaction by developing product requirements and testing plans\n",
168-
"· Monitor and report on product performance, sales, and customer feedback\n",
169-
"· Collaborate with stakeholders, customers, and other partners to develop product enhancements\n",
170-
"Qualifications:\n",
171-
"· Bachelor's degree in engineering, business, marketing, or related field\n",
172-
"· 10+ years of experience in product management, product engineering, product marketing, or related field\n",
173-
"· Proven ability to lead product innovation, develop and execute product strategy, and manage products \n",
174187
"\n"
175188
]
176189
}
@@ -198,14 +211,14 @@
198211
},
199212
{
200213
"cell_type": "code",
201-
"execution_count": 5,
214+
"execution_count": 4,
202215
"metadata": {},
203216
"outputs": [
204217
{
205218
"name": "stdout",
206219
"output_type": "stream",
207220
"text": [
208-
"A product manager is responsible for overseeing the product management team, driving product development and marketing strategy, developing product life-cycle management processes, researching customer needs, collaborating with internal teams, developing pricing strategies, analyzing product performance, and identifying areas for improvement. They should have a bachelor's degree in business, engineering, or a related field, at least 5 years of experience in product management, and a proven track record of successful product launches. [role_library.pdf#page=29, role_library.pdf#page=28, role_library.pdf#page=23, role_library.pdf#page=11]\n"
221+
"A product manager is responsible for overseeing the product management team, driving product development and marketing strategy, and ensuring successful product execution [role_library-28.png]. They collaborate with internal teams such as engineering, sales, marketing, and finance, as well as external partners, suppliers, and customers [role_library-28.png]. They develop and implement product life-cycle management processes, monitor industry trends, develop product marketing plans and go-to-market strategies, research customer needs, collaborate with internal teams, develop pricing strategies and cost models, oversee product portfolio and performance metrics, manage product development budget, and analyze product performance and customer feedback [role_library-28.png]. They should have a bachelor's degree in business, engineering, or a related field and at least 5 years of experience in product management with a proven track record of successful product launches [role_library-28.png]. They should also have excellent project management, organizational, communication, problem-solving, and analytical skills [role_library-28.png][role_library-27.png][role_library-10.png].\n"
209222
]
210223
}
211224
],

0 commit comments

Comments
 (0)