Skip to content

Commit 3385187

Browse files
authored
Easier to re-use search (#620)
1 parent e914960 commit 3385187

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,40 @@ Execute the following command, if you don't have any pre-existing Azure services
116116
1. Run `azd up` - This will provision Azure resources and deploy this sample to those resources, including building the search index based on the files found in the `./data` folder.
117117
* You will be prompted to select two locations, one for the majority of resources and one for the OpenAI resource, which is currently a short list. That location list is based on the [OpenAI model availability table](https://learn.microsoft.com/azure/cognitive-services/openai/concepts/models#model-summary-table-and-region-availability) and may become outdated as availability changes.
118118
1. After the application has been successfully deployed you will see a URL printed to the console. Click that URL to interact with the application in your browser.
119-
120119
It will look like the following:
121120

122121
!['Output from running azd up'](assets/endpoint.png)
123122

124-
> NOTE: It may take a minute for the application to be fully deployed. If you see a "Python Developer" welcome screen, then wait a minute and refresh the page.
123+
> NOTE: It may take 5-10 minutes for the application to be fully deployed. If you see a "Python Developer" welcome screen or an error page, then wait a bit and refresh the page.
125124
126125
### Deploying with existing Azure resources
127126

128-
If you already have existing Azure resources, you can re-use those by setting `azd` environment values. For example:
127+
If you already have existing Azure resources, you can re-use those by setting `azd` environment values.
128+
129+
#### Existing OpenAI resource
129130

130131
1. Run `azd env set AZURE_OPENAI_SERVICE {Name of existing OpenAI service}`
131132
1. Run `azd env set AZURE_OPENAI_RESOURCE_GROUP {Name of existing resource group that OpenAI service is provisioned to}`
132133
1. Run `azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT {Name of existing ChatGPT deployment}`. Only needed if your ChatGPT deployment is not the default 'chat'.
133134
1. Run `azd env set AZURE_OPENAI_EMB_DEPLOYMENT {Name of existing GPT embedding deployment}`. Only needed if your embeddings deployment is not the default 'embedding'.
134-
1. Run `azd up` - This will provision the rest of the Azure resources and deploy this sample to those resources, including building the search index based on the files found in the `./data` folder.
135135

136-
> NOTE: You can also use existing Search and Storage Accounts. See `./infra/main.parameters.json` for list of environment variables to pass to `azd env set` to configure those existing resources.
136+
#### Existing Azure Cognitive Search resource
137+
138+
1. Run `azd env set AZURE_SEARCH_SERVICE {Name of existing Azure Cognitive Search service}`
139+
1. Run `azd env set AZURE_SEARCH_SERVICE_RESOURCE_GROUP {Name of existing resource group with ACS service}`
140+
1. If that resource group is in a different location than the one you'll pick for the `azd up` step,
141+
then run `azd env set AZURE_SEARCH_SERVICE_LOCATION {Location of existing service}`
142+
1. If the search service's SKU is not standard, then run `azd env set AZURE_SEARCH_SERVICE_SKU {Name of SKU}`. ([See possible values](https://learn.microsoft.com/en-us/azure/templates/microsoft.search/searchservices?pivots=deployment-language-bicep#sku))
143+
144+
#### Other existing Azure resources
145+
146+
You can also use existing Form Recognizer and Storage Accounts. See `./infra/main.parameters.json` for list of environment variables to pass to `azd env set` to configure those existing resources.
147+
148+
#### Provision remaining resources
149+
150+
Now you can run `azd up`, following the steps in [Deploying from scratch](#deploying-from-scratch) above.
151+
That will both provision resources and deploy the code.
152+
137153

138154
### Deploying again
139155

infra/main.bicep

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ param applicationInsightsName string = ''
1717

1818
param searchServiceName string = ''
1919
param searchServiceResourceGroupName string = ''
20-
param searchServiceResourceGroupLocation string = location
21-
22-
param searchServiceSkuName string = 'standard'
20+
param searchServiceLocation string = ''
21+
param searchServiceSkuName string // Set in main.parameters.json
2322
param searchIndexName string // Set in main.parameters.json
2423

2524
param storageAccountName string = ''
@@ -197,7 +196,7 @@ module searchService 'core/search/search-services.bicep' = {
197196
scope: searchServiceResourceGroup
198197
params: {
199198
name: !empty(searchServiceName) ? searchServiceName : 'gptkb-${resourceToken}'
200-
location: searchServiceResourceGroupLocation
199+
location: !empty(searchServiceLocation) ? searchServiceLocation : location
201200
tags: tags
202201
authOptions: {
203202
aadOrApiKey: {

infra/main.parameters.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@
4141
"searchServiceResourceGroupName": {
4242
"value": "${AZURE_SEARCH_SERVICE_RESOURCE_GROUP}"
4343
},
44+
"searchServiceLocation": {
45+
"value": "${AZURE_SEARCH_SERVICE_LOCATION}"
46+
},
4447
"searchServiceSkuName": {
45-
"value": "standard"
48+
"value": "${AZURE_SEARCH_SERVICE_SKU=standard}"
4649
},
4750
"storageAccountName": {
4851
"value": "${AZURE_STORAGE_ACCOUNT}"

0 commit comments

Comments
 (0)