Skip to content

Commit 5e9a431

Browse files
Added Environment Variables for setting Names of Resources (#1389)
* Added Environment Variables to allow setting the names of most resources. + App Service Plan Name + App Service Name (backend service) + Application Insights Name + Application Insights Dashboard Name + Log Analytics Workspace Name Two Global Resources are created, whose names have not been parameterised. These are - Action group (Application Insights Smart Detection) - Smart detector alert rule (Failure Anomalies - $AZURE_APPLICATION_INSIGHTS) * Added Environment Variables for Computer Vision Name, RG, Location and SKU Parameters * Computer Vision SKU - Removed incorrect default * Update azure-dev.yml Added ENV Variables also to workflow * Updated deploy_existing.md and pipelines. * Updated main.bicep variables to show reference to main.parameters.json file. Updated some defaults. * Expanded allow-list of Document Intelligence regions. * Reverted my change of Document Intelligence resource locations, since the Preview API is only available in the listed three locations. * Add empty string default back * update toc * bring back comment --------- Co-authored-by: Pamela Fox <[email protected]> Co-authored-by: Pamela Fox <[email protected]>
1 parent 24434dd commit 5e9a431

File tree

6 files changed

+114
-36
lines changed

6 files changed

+114
-36
lines changed

.azdo/pipelines/azure-dev.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ steps:
4646
AZURE_OPENAI_SERVICE: $(AZURE_OPENAI_SERVICE)
4747
AZURE_OPENAI_API_VERSION: $(AZURE_OPENAI_API_VERSION)
4848
AZURE_OPENAI_RESOURCE_GROUP: $(AZURE_OPENAI_RESOURCE_GROUP)
49-
AZURE_FORMRECOGNIZER_SERVICE: $(AZURE_FORMRECOGNIZER_SERVICE)
50-
AZURE_FORMRECOGNIZER_RESOURCE_GROUP: $(AZURE_FORMRECOGNIZER_RESOURCE_GROUP)
51-
AZURE_FORMRECOGNIZER_SKU: $(AZURE_FORMRECOGNIZER_SKU)
49+
AZURE_DOCUMENTINTELLIGENCE_SERVICE: $(AZURE_DOCUMENTINTELLIGENCE_SERVICE)
50+
AZURE_DOCUMENTINTELLIGENCE_RESOURCE_GROUP: $(AZURE_DOCUMENTINTELLIGENCE_RESOURCE_GROUP)
51+
AZURE_DOCUMENTINTELLIGENCE_SKU: $(AZURE_DOCUMENTINTELLIGENCE_SKU)
52+
AZURE_DOCUMENTINTELLIGENCE_LOCATION: $(AZURE_DOCUMENTINTELLIGENCE_LOCATION)
5253
AZURE_SEARCH_INDEX: $(AZURE_SEARCH_INDEX)
5354
AZURE_SEARCH_SERVICE: $(AZURE_SEARCH_SERVICE)
5455
AZURE_SEARCH_SERVICE_RESOURCE_GROUP: $(AZURE_SEARCH_SERVICE_RESOURCE_GROUP)
@@ -73,10 +74,17 @@ steps:
7374
OPENAI_API_KEY: $(OPENAI_API_KEY)
7475
OPENAI_ORGANIZATION: $(OPENAI_ORGANIZATION)
7576
AZURE_USE_APPLICATION_INSIGHTS: $(AZURE_USE_APPLICATION_INSIGHTS)
77+
AZURE_APPLICATION_INSIGHTS: $(AZURE_APPLICATION_INSIGHTS)
78+
AZURE_APPLICATION_INSIGHTS_DASHBOARD: $(AZURE_APPLICATION_INSIGHTS_DASHBOARD)
79+
AZURE_LOG_ANALYTICS: $(AZURE_LOG_ANALYTICS)
7680
USE_VECTORS: $(USE_VECTORS)
7781
USE_GPT4V: $(USE_GPT4V)
7882
AZURE_VISION_ENDPOINT: $(AZURE_VISION_ENDPOINT)
7983
VISION_SECRET_NAME: $(VISION_SECRET_NAME)
84+
AZURE_COMPUTER_VISION_SERVICE: $(AZURE_COMPUTER_VISION_SERVICE)
85+
AZURE_COMPUTER_VISION_RESOURCE_GROUP: $(AZURE_COMPUTER_VISION_RESOURCE_GROUP)
86+
AZURE_COMPUTER_VISION_LOCATION: $(AZURE_COMPUTER_VISION_LOCATION)
87+
AZURE_COMPUTER_VISION_SKU: $(AZURE_COMPUTER_VISION_SKU)
8088
AZURE_KEY_VAULT_NAME: $(AZURE_KEY_VAULT_NAME)
8189
AZURE_USE_AUTHENTICATION: $(AZURE_USE_AUTHENTICATION)
8290
AZURE_ENFORCE_ACCESS_CONTROL: $(AZURE_ENFORCE_ACCESS_CONTROL)

.github/workflows/azure-dev.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ jobs:
3232
AZURE_OPENAI_SERVICE: ${{ vars.AZURE_OPENAI_SERVICE }}
3333
AZURE_OPENAI_API_VERSION: ${{ vars.AZURE_OPENAI_API_VERSION }}
3434
AZURE_OPENAI_RESOURCE_GROUP: ${{ vars.AZURE_OPENAI_RESOURCE_GROUP }}
35+
AZURE_COMPUTER_VISION_SERVICE: ${{ vars.AZURE_COMPUTER_VISION_SERVICE }}
36+
AZURE_COMPUTER_VISION_RESOURCE_GROUP: ${{ vars.AZURE_COMPUTER_VISION_RESOURCE_GROUP }}
37+
AZURE_COMPUTER_VISION_LOCATION: ${{ vars.AZURE_COMPUTER_VISION_LOCATION }}
38+
AZURE_COMPUTER_VISION_SKU: ${{ vars.AZURE_COMPUTER_VISION_SKU }}
3539
AZURE_FORMRECOGNIZER_SERVICE: ${{ vars.AZURE_FORMRECOGNIZER_SERVICE }}
3640
AZURE_FORMRECOGNIZER_RESOURCE_GROUP: ${{ vars.AZURE_FORMRECOGNIZER_RESOURCE_GROUP }}
3741
AZURE_FORMRECOGNIZER_SKU: ${{ vars.AZURE_FORMRECOGNIZER_SKU }}
@@ -46,7 +50,9 @@ jobs:
4650
AZURE_STORAGE_ACCOUNT: ${{ vars.AZURE_STORAGE_ACCOUNT }}
4751
AZURE_STORAGE_RESOURCE_GROUP: ${{ vars.AZURE_STORAGE_RESOURCE_GROUP }}
4852
AZURE_STORAGE_SKU: ${{ vars.AZURE_STORAGE_SKU }}
53+
AZURE_APP_SERVICE_PLAN: ${{ vars.AZURE_APP_SERVICE_PLAN }}
4954
AZURE_APP_SERVICE_SKU: ${{ vars.AZURE_APP_SERVICE_SKU }}
55+
AZURE_APP_SERVICE: ${{ vars.AZURE_APP_SERVICE }}
5056
AZURE_OPENAI_CHATGPT_MODEL: ${{ vars.AZURE_OPENAI_CHATGPT_MODEL }}
5157
AZURE_OPENAI_CHATGPT_DEPLOYMENT: ${{ vars.AZURE_OPENAI_CHATGPT_DEPLOYMENT }}
5258
AZURE_OPENAI_CHATGPT_DEPLOYMENT_CAPACITY: ${{ vars.AZURE_OPENAI_CHATGPT_DEPLOYMENT_CAPACITY }}
@@ -59,6 +65,9 @@ jobs:
5965
OPENAI_API_KEY: ${{ vars.OPENAI_API_KEY }}
6066
OPENAI_ORGANIZATION: ${{ vars.OPENAI_ORGANIZATION }}
6167
AZURE_USE_APPLICATION_INSIGHTS: ${{ vars.AZURE_USE_APPLICATION_INSIGHTS }}
68+
AZURE_APPLICATION_INSIGHTS: ${{ vars.AZURE_APPLICATION_INSIGHTS }}
69+
AZURE_APPLICATION_INSIGHTS_DASHBOARD: ${{ vars.AZURE_APPLICATION_INSIGHTS_DASHBOARD }}
70+
AZURE_LOG_ANALYTICS: ${{ vars.AZURE_LOG_ANALYTICS }}
6271
USE_VECTORS: ${{ vars.USE_VECTORS }}
6372
USE_GPT4V: ${{ vars.USE_GPT4V }}
6473
AZURE_VISION_ENDPOINT: ${{ vars.AZURE_VISION_ENDPOINT }}

azure.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ pipeline:
2525
- AZURE_OPENAI_SERVICE
2626
- AZURE_OPENAI_API_VERSION
2727
- AZURE_OPENAI_RESOURCE_GROUP
28-
- AZURE_FORMRECOGNIZER_SERVICE
29-
- AZURE_FORMRECOGNIZER_RESOURCE_GROUP
30-
- AZURE_FORMRECOGNIZER_SKU
28+
- AZURE_DOCUMENTINTELLIGENCE_SERVICE
29+
- AZURE_DOCUMENTINTELLIGENCE_RESOURCE_GROUP
30+
- AZURE_DOCUMENTINTELLIGENCE_SKU
31+
- AZURE_DOCUMENTINTELLIGENCE_LOCATION
3132
- AZURE_SEARCH_INDEX
3233
- AZURE_SEARCH_SERVICE
3334
- AZURE_SEARCH_SERVICE_RESOURCE_GROUP
@@ -39,7 +40,9 @@ pipeline:
3940
- AZURE_STORAGE_ACCOUNT
4041
- AZURE_STORAGE_RESOURCE_GROUP
4142
- AZURE_STORAGE_SKU
43+
- AZURE_APP_SERVICE
4244
- AZURE_APP_SERVICE_SKU
45+
- AZURE_APP_SERVICE_PLAN
4346
- AZURE_OPENAI_CHATGPT_MODEL
4447
- AZURE_OPENAI_CHATGPT_DEPLOYMENT
4548
- AZURE_OPENAI_CHATGPT_DEPLOYMENT_CAPACITY
@@ -52,10 +55,17 @@ pipeline:
5255
- OPENAI_API_KEY
5356
- OPENAI_ORGANIZATION
5457
- AZURE_USE_APPLICATION_INSIGHTS
58+
- AZURE_APPLICATION_INSIGHTS
59+
- AZURE_APPLICATION_INSIGHTS_DASHBOARD
60+
- AZURE_LOG_ANALYTICS
5561
- USE_VECTORS
5662
- USE_GPT4V
5763
- AZURE_VISION_ENDPOINT
5864
- VISION_SECRET_NAME
65+
- AZURE_COMPUTER_VISION_SERVICE
66+
- AZURE_COMPUTER_VISION_RESOURCE_GROUP
67+
- AZURE_COMPUTER_VISION_LOCATION
68+
- AZURE_COMPUTER_VISION_SKU
5969
- AZURE_KEY_VAULT_NAME
6070
- AZURE_USE_AUTHENTICATION
6171
- AZURE_ENFORCE_ACCESS_CONTROL

docs/deploy_existing.md

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11

22
# Deploying with existing Azure resources
33

4-
If you already have existing Azure resources, you can re-use those by setting `azd` environment values.
4+
If you already have existing Azure resources, or if you want to specify the exact name of new Azure Resource, you can do so by setting `azd` environment values.
55
You should set these values before running `azd up`. Once you've set them, return to the [deployment steps](../README.md#deploying).
66

7-
* [Existing resource group](#existing-resource-group)
8-
* [Existing OpenAI resource](#existing-openai-resource)
9-
* [Existing Azure AI Search resource](#existing-azure-ai-search-resource)
10-
* [Existing Azure Document Intelligence resource](#existing-azure-document-intelligence-resource)
11-
* [Other existing Azure resources](#other-existing-azure-resources)
7+
* [Resource group](#resource-group)
8+
* [OpenAI resource](#openai-resource)
9+
* [Azure AI Search resource](#azure-ai-search-resource)
10+
* [Azure App Service Plan and App Service resources](#azure-app-service-plan-and-app-service-resources)
11+
* [Azure Application Insights and related resources](#azure-application-insights-and-related-resources)
12+
* [Azure Computer Vision resources](#azure-computer-vision-resources)
13+
* [Azure Document Intelligence resource](#azure-document-intelligence-resource)
14+
* [Other Azure resources](#other-azure-resources)
1215

13-
## Existing resource group
16+
17+
## Resource group
1418

1519
1. Run `azd env set AZURE_RESOURCE_GROUP {Name of existing resource group}`
1620
1. Run `azd env set AZURE_LOCATION {Location of existing resource group}`
1721

18-
## Existing OpenAI resource
22+
## OpenAI resource
1923

2024
### Azure OpenAI:
2125

@@ -40,7 +44,7 @@ Do *not* check your key into source control.
4044
When you run `azd up` after and are prompted to select a value for `openAiResourceGroupLocation`, you can select any location as it will not be used.
4145

4246

43-
## Existing Azure AI Search resource
47+
## Azure AI Search resource
4448

4549
1. Run `azd env set AZURE_SEARCH_SERVICE {Name of existing Azure AI Search service}`
4650
1. Run `azd env set AZURE_SEARCH_SERVICE_RESOURCE_GROUP {Name of existing resource group with ACS service}`
@@ -55,7 +59,26 @@ You can also customize the search service (new or existing) for non-English sear
5559
1. To turn off the spell checker, run `azd env set AZURE_SEARCH_QUERY_SPELLER none`. Consult [this table](https://learn.microsoft.com/rest/api/searchservice/preview-api/search-documents#queryLanguage) to determine if spell checker is supported for your query language.
5660
1. To configure the name of the analyzer to use for a searchable text field to a value other than "en.microsoft", run `azd env set AZURE_SEARCH_ANALYZER_NAME {Name of analyzer name}`. ([See other possible values](https://learn.microsoft.com/dotnet/api/microsoft.azure.search.models.field.analyzer?view=azure-dotnet-legacy&viewFallbackFrom=azure-dotnet))
5761

58-
## Existing Azure Document Intelligence resource
62+
## Azure App Service Plan and App Service resources
63+
64+
1. Run `azd env set AZURE_APP_SERVICE_PLAN {Name of existing Azure App Service Plan}`
65+
1. Run `azd env set AZURE_APP_SERVICE {Name of existing Azure App Service}`.
66+
1. Run `azd env set AZURE_APP_SERVICE_SKU {SKU of Azure App Service, defaults to B1}`.
67+
68+
## Azure Application Insights and related resources
69+
70+
1. Run `azd env set AZURE_APPLICATION_INSIGHTS {Name of existing Azure App Insights}`.
71+
1. Run `azd env set AZURE_APPLICATION_INSIGHTS_DASHBOARD {Name of existing Azure App Insights Dashboard}`.
72+
1. Run `azd env set AZURE_LOG_ANALYTICS {Name of existing Azure Log Analytics Workspace Name}`.
73+
74+
## Azure Computer Vision resources
75+
76+
1. Run `azd env set AZURE_COMPUTER_VISION_SERVICE {Name of existing Azure Computer Vision Service Name}`
77+
1. Run `azd env set AZURE_COMPUTER_VISION_RESOURCE_GROUP {Name of existing Azure Computer Vision Resource Group Name}`
78+
1. Run `azd env set AZURE_COMPUTER_VISION_LOCATION {Name of existing Azure Computer Vision Location}`
79+
1. Run `azd env set AZURE_COMPUTER_VISION_SKU {SKU of Azure Computer Vision service, defaults to F0}`
80+
81+
## Azure Document Intelligence resource
5982

6083
In order to support analysis of many document formats, this repository uses a preview version of Azure Document Intelligence (formerly Form Recognizer) that is only available in [limited regions](https://learn.microsoft.com/azure/ai-services/document-intelligence/concept-layout).
6184
If your existing resource is in one of those regions, then you can re-use it by setting the following environment variables:
@@ -65,6 +88,6 @@ If your existing resource is in one of those regions, then you can re-use it by
6588
1. Run `azd env set AZURE_DOCUMENTINTELLIGENCE_RESOURCE_GROUP {Name of resource group with existing service, defaults to main resource group}`
6689
1. Run `azd env set AZURE_DOCUMENTINTELLIGENCE_SKU {SKU of existing service, defaults to S0}`
6790

68-
## Other existing Azure resources
91+
## Other Azure resources
6992

70-
You can also use existing Azure AI Document Intelligence and Storage Accounts. See `./infra/main.parameters.json` for list of environment variables to pass to `azd env set` to configure those existing resources.
93+
You can also use existing Azure AI Storage Accounts. See `./infra/main.parameters.json` for list of environment variables to pass to `azd env set` to configure those existing resources.

infra/main.bicep

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ param environmentName string
99
@description('Primary location for all resources')
1010
param location string
1111

12-
param appServicePlanName string = ''
13-
param backendServiceName string = ''
14-
param resourceGroupName string = ''
12+
param appServicePlanName string = '' // Set in main.parameters.json
13+
param backendServiceName string = '' // Set in main.parameters.json
14+
param resourceGroupName string = '' // Set in main.parameters.json
1515

16-
param applicationInsightsDashboardName string = ''
17-
param applicationInsightsName string = ''
18-
param logAnalyticsName string = ''
16+
param applicationInsightsDashboardName string = '' // Set in main.parameters.json
17+
param applicationInsightsName string = '' // Set in main.parameters.json
18+
param logAnalyticsName string = '' // Set in main.parameters.json
1919

20-
param searchServiceName string = ''
21-
param searchServiceResourceGroupName string = ''
22-
param searchServiceLocation string = ''
20+
param searchServiceName string = '' // Set in main.parameters.json
21+
param searchServiceResourceGroupName string = '' // Set in main.parameters.json
22+
param searchServiceLocation string = '' // Set in main.parameters.json
2323
// The free tier does not support managed identity (required) or semantic search (optional)
2424
@allowed([ 'free', 'basic', 'standard', 'standard2', 'standard3', 'storage_optimized_l1', 'storage_optimized_l2' ])
2525
param searchServiceSkuName string // Set in main.parameters.json
@@ -30,8 +30,8 @@ param searchServiceSemanticRankerLevel string // Set in main.parameters.json
3030
var actualSearchServiceSemanticRankerLevel = (searchServiceSkuName == 'free') ? 'disabled' : searchServiceSemanticRankerLevel
3131
param useSearchServiceKey bool = searchServiceSkuName == 'free'
3232

33-
param storageAccountName string = ''
34-
param storageResourceGroupName string = ''
33+
param storageAccountName string = '' // Set in main.parameters.json
34+
param storageResourceGroupName string = '' // Set in main.parameters.json
3535
param storageResourceGroupLocation string = location
3636
param storageContainerName string = 'content'
3737
param storageSkuName string // Set in main.parameters.json
@@ -66,8 +66,9 @@ param openAiSkuName string = 'S0'
6666
param openAiApiKey string = ''
6767
param openAiApiOrganization string = ''
6868

69-
param documentIntelligenceServiceName string = ''
70-
param documentIntelligenceResourceGroupName string = ''
69+
param documentIntelligenceServiceName string = '' // Set in main.parameters.json
70+
param documentIntelligenceResourceGroupName string = '' // Set in main.parameters.json
71+
7172
// Limited regions for new version:
7273
// https://learn.microsoft.com/azure/ai-services/document-intelligence/concept-layout
7374
@description('Location for the Document Intelligence resource group')
@@ -79,12 +80,12 @@ param documentIntelligenceResourceGroupName string = ''
7980
})
8081
param documentIntelligenceResourceGroupLocation string
8182

82-
param documentIntelligenceSkuName string = 'S0'
83+
param documentIntelligenceSkuName string // Set in main.parameters.json
8384

84-
param computerVisionServiceName string = ''
85-
param computerVisionResourceGroupName string = ''
86-
param computerVisionResourceGroupLocation string = 'eastus' // Vision vectorize API is yet to be deployed globally
87-
param computerVisionSkuName string = 'S1'
85+
param computerVisionServiceName string = '' // Set in main.parameters.json
86+
param computerVisionResourceGroupName string = '' // Set in main.parameters.json
87+
param computerVisionResourceGroupLocation string = '' // Set in main.parameters.json
88+
param computerVisionSkuName string // Set in main.parameters.json
8889

8990
param chatGptModelName string = ''
9091
param chatGptDeploymentName string = ''

infra/main.parameters.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@
2323
"openAiSkuName": {
2424
"value": "S0"
2525
},
26+
"computerVisionServiceName": {
27+
"value": "${AZURE_COMPUTER_VISION_SERVICE}"
28+
},
29+
"computerVisionResourceGroupName": {
30+
"value": "${AZURE_COMPUTER_VISION_RESOURCE_GROUP}"
31+
},
32+
"computerVisionResourceGroupLocation": {
33+
"value": "${AZURE_COMPUTER_VISION_LOCATION=eastus}"
34+
},
35+
"computerVisionSkuName": {
36+
"value": "${AZURE_COMPUTER_VISION_SKU=S1}"
37+
},
2638
"documentIntelligenceServiceName": {
2739
"value": "${AZURE_DOCUMENTINTELLIGENCE_SERVICE}"
2840
},
@@ -68,9 +80,15 @@
6880
"storageSkuName": {
6981
"value": "${AZURE_STORAGE_SKU=Standard_LRS}"
7082
},
83+
"appServicePlanName": {
84+
"value": "${AZURE_APP_SERVICE_PLAN}"
85+
},
7186
"appServiceSkuName": {
7287
"value": "${AZURE_APP_SERVICE_SKU=B1}"
7388
},
89+
"backendServiceName": {
90+
"value": "${AZURE_APP_SERVICE}"
91+
},
7492
"chatGptModelName":{
7593
"value": "${AZURE_OPENAI_CHATGPT_MODEL}"
7694
},
@@ -113,6 +131,15 @@
113131
"useApplicationInsights": {
114132
"value": "${AZURE_USE_APPLICATION_INSIGHTS=true}"
115133
},
134+
"applicationInsightsName": {
135+
"value": "${AZURE_APPLICATION_INSIGHTS}"
136+
},
137+
"applicationInsightsDashboardName": {
138+
"value": "${AZURE_APPLICATION_INSIGHTS_DASHBOARD}"
139+
},
140+
"logAnalyticsName": {
141+
"value": "${AZURE_LOG_ANALYTICS}"
142+
},
116143
"useVectors": {
117144
"value": "${USE_VECTORS=true}"
118145
},

0 commit comments

Comments
 (0)