Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Commit a2f191b

Browse files
committed
code cleanup and removal of unnecessary variables
1 parent 19588f0 commit a2f191b

File tree

5 files changed

+783
-1861
lines changed

5 files changed

+783
-1861
lines changed

infra/core/scripts/deployment-script.bicep

Lines changed: 63 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,65 @@
1-
param name string
21
param utcValue string
32
param location string
4-
param subscriptionId string
5-
param tenantid string
63

7-
param azure_acr_login_server string
8-
9-
param azure_location string
10-
11-
param azure_aks_name string
12-
param azure_aks_controlplanefqdn string
13-
param azure_aks_managed_rg string
14-
param azure_aks_service_account_name string
15-
16-
param azure_apim_gateway_url string
17-
param azure_apim_name string
18-
19-
param managed_identity_aks string
4+
param acr_login_server string
205

6+
param ai_search_audience string = 'https://search.azure.com'
217
param ai_search_name string
22-
8+
param ai_search_endpoint_suffix string = 'search.windows.net'
9+
10+
param aks_name string
11+
param aks_service_account_name string
12+
param aks_managed_identity string
13+
14+
param aoai_endpoint string
15+
param aoai_llm_model string
16+
param aoai_llm_model_deployment_name string
17+
param aoai_llm_model_api_version string
18+
param aoai_embedding_model string
19+
param aoai_embedding_model_deployment_name string
20+
param aoai_embedding_model_api_version string
21+
22+
param app_hostname string
23+
param app_insights_connection_string string
24+
param cosmosdb_endpoint string
2325
param image_name string
2426
param image_version string
2527
param script_file string
26-
27-
param azure_aoai_endpoint string
28-
param azure_aoai_llm_model string
29-
param azure_aoai_llm_model_deployment_name string
30-
param azure_aoai_llm_model_api_version string
31-
param azure_aoai_embedding_model string
32-
param azure_aoai_embedding_model_deployment_name string
33-
param azure_aoai_embedding_model_api_version string
34-
35-
param azure_app_hostname string
36-
param azure_app_url string
37-
param azure_app_insights_connection_string string
38-
39-
param azure_cosmosdb_endpoint string
40-
param azure_cosmosdb_name string
41-
param azure_cosmosdb_id string
42-
param azure_dns_zone_name string
43-
44-
param azure_storage_account string
45-
param azure_storage_account_blob_url string
46-
47-
param azure_workload_identity_client_id string
48-
param azure_workload_identity_principal_id string
49-
param azure_workload_identity_name string
50-
28+
param storage_account_blob_url string
29+
param workload_identity_client_id string
5130
param cognitive_services_audience string = 'https://cognitiveservices.azure.com/default'
5231

5332
param public_storage_account_name string
33+
@secure()
5434
param public_storage_account_key string
5535

5636
var clusterAdminRoleDefinitionId = resourceId(
5737
'Microsoft.Authorization/roleDefinitions',
58-
'0ab0b1a8-8aac-4efd-b8c2-3ee1fb270be8'
38+
'b1ff04bb-8a4e-4dc4-8eb5-8693973ce19b' // 'Azure Kubernetes Service RBAC Cluster Admin' role
5939
)
6040

6141
// Resources
6242
resource aksCluster 'Microsoft.ContainerService/managedClusters@2024-09-02-preview' existing = {
63-
name: azure_aks_name
43+
name: aks_name
6444
}
6545

6646
resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
67-
name: uniqueString(resourceGroup().id)
47+
name: 'deployment-script-id-${uniqueString(resourceGroup().id)}'
6848
location: location
6949
}
7050

71-
resource clusterAdminContributorRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
72-
name: guid(managed_identity_aks, aksCluster.id, clusterAdminRoleDefinitionId)
51+
resource clusterAdminRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
52+
name: guid(managedIdentity.id, aksCluster.id, clusterAdminRoleDefinitionId)
7353
scope: aksCluster
7454
properties: {
75-
roleDefinitionId: clusterAdminRoleDefinitionId
7655
principalId: managedIdentity.properties.principalId
7756
principalType: 'ServicePrincipal'
57+
roleDefinitionId: clusterAdminRoleDefinitionId
7858
}
7959
}
8060

8161
resource deploymentScript 'Microsoft.Resources/deploymentScripts@2023-08-01' = {
82-
name: name
62+
name: 'deployment-script-deployment'
8363
location: location
8464
kind: 'AzureCLI'
8565
identity: {
@@ -98,48 +78,53 @@ resource deploymentScript 'Microsoft.Resources/deploymentScripts@2023-08-01' = {
9878
timeout: 'PT1H'
9979
environmentVariables: [
10080
{
101-
name: 'AZURE_SUBSCRIPTION_ID'
102-
value: subscriptionId
81+
name: 'ACR_SERVER'
82+
value: acr_login_server
10383
}
84+
{ name: 'AI_SEARCH_AUDIENCE', value: ai_search_audience }
85+
{ name: 'AI_SEARCH_ENDPOINT_SUFFIX', value: ai_search_endpoint_suffix }
10486
{
105-
name: 'AZURE_TENANT_ID'
106-
value: tenantid
87+
name: 'AI_SEARCH_NAME'
88+
value: ai_search_name
10789
}
10890
{
109-
name: 'ACR_SERVER'
110-
value: azure_acr_login_server
91+
name: 'AKS_NAME'
92+
value: aks_name
11193
}
11294
{
113-
name: 'AZURE_LOCATION'
114-
value: azure_location
95+
name: 'AKS_SERVICE_ACCOUNT_NAME'
96+
value: aks_service_account_name
11597
}
11698
{
117-
name: 'AZURE_AKS_NAME'
118-
value: azure_aks_name
99+
name: 'AOAI_LLM_MODEL'
100+
value: aoai_llm_model
119101
}
120102
{
121-
name: 'AZURE_AKS_CONTROLPLANEFQDN'
122-
value: azure_aks_controlplanefqdn
103+
name: 'AOAI_LLM_MODEL_DEPLOYMENT_NAME'
104+
value: aoai_llm_model_deployment_name
123105
}
124106
{
125-
name: 'AZURE_AKS_MANAGED_RG'
126-
value: azure_aks_managed_rg
107+
name: 'AOAI_LLM_MODEL_API_VERSION'
108+
value: aoai_llm_model_api_version
127109
}
128110
{
129-
name: 'AZURE_AKS_SERVICE_ACCOUNT_NAME'
130-
value: azure_aks_service_account_name
111+
name: 'AOAI_EMBEDDING_MODEL'
112+
value: aoai_embedding_model
131113
}
132114
{
133-
name: 'AZURE_APIM_GATEWAY_URL'
134-
value: azure_apim_gateway_url
115+
name: 'AOAI_EMBEDDING_MODEL_DEPLOYMENT_NAME'
116+
value: aoai_embedding_model_deployment_name
135117
}
118+
{ name: 'AOAI_EMBEDDING_MODEL_API_VERSION', value: aoai_embedding_model_api_version }
119+
{ name: 'APP_HOSTNAME', value: app_hostname }
120+
{ name: 'APP_INSIGHTS_CONNECTION_STRING', value: app_insights_connection_string }
136121
{
137-
name: 'AZURE_APIM_NAME'
138-
value: azure_apim_name
122+
name: 'COGNITIVE_SERVICES_AUDIENCE'
123+
value: cognitive_services_audience
139124
}
140125
{
141-
name: 'MANAGED_IDENTITY_AKS'
142-
value: managed_identity_aks
126+
name: 'COSMOSDB_ENDPOINT'
127+
value: cosmosdb_endpoint
143128
}
144129
{
145130
name: 'IMAGE_NAME'
@@ -150,71 +135,21 @@ resource deploymentScript 'Microsoft.Resources/deploymentScripts@2023-08-01' = {
150135
value: image_version
151136
}
152137
{
153-
name: 'AI_SEARCH_NAME'
154-
value: ai_search_name
155-
}
156-
157-
{
158-
name: 'AZURE_AOAI_LLM_MODEL'
159-
value: azure_aoai_llm_model
160-
}
161-
{
162-
name: 'AZURE_AOAI_LLM_MODEL_DEPLOYMENT_NAME'
163-
value: azure_aoai_llm_model_deployment_name
164-
}
165-
{
166-
name: 'AZURE_AOAI_LLM_MODEL_API_VERSION'
167-
value: azure_aoai_llm_model_api_version
168-
}
169-
{
170-
name: 'AZURE_AOAI_EMBEDDING_MODEL'
171-
value: azure_aoai_embedding_model
172-
}
173-
{
174-
name: 'AZURE_AOAI_EMBEDDING_MODEL_DEPLOYMENT_NAME'
175-
value: azure_aoai_embedding_model_deployment_name
138+
name: 'OPENAI_ENDPOINT'
139+
value: aoai_endpoint
176140
}
177-
{ name: 'AZURE_AOAI_EMBEDDING_MODEL_API_VERSION', value: azure_aoai_embedding_model_api_version }
178-
{ name: 'AZURE_APP_HOSTNAME', value: azure_app_hostname }
179-
{ name: 'AZURE_APP_URL', value: azure_app_url }
180-
{ name: 'AZURE_APP_INSIGHTS_CONNECTION_STRING', value: azure_app_insights_connection_string }
181141
{
182-
name: 'AZURE_COSMOSDB_ENDPOINT'
183-
value: azure_cosmosdb_endpoint
184-
}
185-
{ name: 'AZURE_COSMOSDB_NAME', value: azure_cosmosdb_name }
186-
{ name: 'AZURE_COSMOSDB_ID', value: azure_cosmosdb_id }
187-
{ name: 'AZURE_DNS_ZONE_NAME', value: azure_dns_zone_name }
188-
{ name: 'AZURE_STORAGE_ACCOUNT', value: azure_storage_account }
189-
{ name: 'AZURE_STORAGE_ACCOUNT_BLOB_URL', value: azure_storage_account_blob_url }
190-
{
191-
name: 'AZURE_WORKLOAD_IDENTITY_CLIENT_ID'
192-
value: azure_workload_identity_client_id
193-
}
194-
{
195-
name: 'AZURE_WORKLOAD_IDENTITY_PRINCIPAL_ID'
196-
value: azure_workload_identity_principal_id
197-
}
198-
{
199-
name: 'AZURE_WORKLOAD_IDENTITY_NAME'
200-
value: azure_workload_identity_name
201-
}
202-
{
203-
name: 'COGNITIVE_SERVICES_AUDIENCE'
204-
value: cognitive_services_audience
205-
}
206-
{
207-
name: 'AZURE_OPENAI_ENDPOINT'
208-
value: azure_aoai_endpoint
142+
name: 'RESOURCE_GROUP'
143+
value: resourceGroup().name
209144
}
145+
{ name: 'STORAGE_ACCOUNT_BLOB_URL', value: storage_account_blob_url }
210146
{
211-
name: 'AZURE_RESOURCE_GROUP'
212-
value: resourceGroup().name
147+
name: 'WORKLOAD_IDENTITY_CLIENT_ID'
148+
value: workload_identity_client_id
213149
}
214150
]
215151
cleanupPreference: 'OnSuccess'
216152
retentionInterval: 'P1D'
217-
//primaryScriptUri: primaryScriptUri
218153
scriptContent: script_file
219154
}
220155
dependsOn: [

infra/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,14 +567,14 @@ installGraphRAGHelmChart () {
567567
--set "graphragConfig.AI_SEARCH_URL=https://$aiSearchName.$AISEARCH_ENDPOINT_SUFFIX" \
568568
--set "graphragConfig.AI_SEARCH_AUDIENCE=$AI_SEARCH_AUDIENCE" \
569569
--set "graphragConfig.APPLICATIONINSIGHTS_CONNECTION_STRING=$appInsightsConnectionString" \
570+
--set "graphragConfig.COGNITIVE_SERVICES_AUDIENCE=$COGNITIVE_SERVICES_AUDIENCE" \
570571
--set "graphragConfig.COSMOS_URI_ENDPOINT=$cosmosEndpoint" \
571572
--set "graphragConfig.GRAPHRAG_API_BASE=$graphragApiBase" \
572573
--set "graphragConfig.GRAPHRAG_API_VERSION=$graphragApiVersion" \
573574
--set "graphragConfig.GRAPHRAG_LLM_MODEL=$graphragLlmModel" \
574575
--set "graphragConfig.GRAPHRAG_LLM_DEPLOYMENT_NAME=$graphragLlmModelDeployment" \
575576
--set "graphragConfig.GRAPHRAG_EMBEDDING_MODEL=$graphragEmbeddingModel" \
576577
--set "graphragConfig.GRAPHRAG_EMBEDDING_DEPLOYMENT_NAME=$graphragEmbeddingModelDeployment" \
577-
--set "graphragConfig.COGNITIVE_SERVICES_AUDIENCE=$COGNITIVE_SERVICES_AUDIENCE" \
578578
--set "graphragConfig.STORAGE_ACCOUNT_BLOB_URL=$storageAccountBlobUrl"
579579

580580
local helmResult

infra/main.bicep

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -408,47 +408,32 @@ module privateLinkScopePrivateEndpoint 'core/vnet/private-endpoint.bicep' = if (
408408

409409
// the following deploymentScript module will only be deployed when performing a managed app deployment
410410
module deploymentScript 'core/scripts/deployment-script.bicep' = if (!empty(publicStorageAccountName) && !empty(publicStorageAccountKey)) {
411-
name: utcString
411+
name: 'deploy-script-deployment-${utcString}'
412412
params: {
413-
name: 'graphragscript'
414413
location: location
415-
tenantid: tenant().tenantId
416-
subscriptionId: subscription().id
417414
script_file: loadTextContent('managed-app/artifacts/scripts/updategraphrag.sh')
418415
public_storage_account_name: publicStorageAccountName
419416
public_storage_account_key: publicStorageAccountKey
420-
utcValue: utcString
417+
acr_login_server: deployAcr ? acr.outputs.loginServer : existingAcrLoginServer
421418
ai_search_name: aiSearch.name
422-
azure_location: location
423-
azure_acr_login_server: deployAcr ? acr.outputs.loginServer : existingAcrLoginServer
424-
azure_aks_name: aks.outputs.name
425-
azure_aks_controlplanefqdn: aks.outputs.controlPlaneFqdn
426-
azure_aks_managed_rg: aks.outputs.managedResourceGroup
427-
azure_aks_service_account_name: aksServiceAccountName
428-
azure_aoai_endpoint: aoai.outputs.endpoint
429-
azure_aoai_llm_model: aoai.outputs.llmModel
430-
azure_aoai_llm_model_deployment_name: aoai.outputs.llmModelDeploymentName
431-
azure_aoai_llm_model_api_version: aoai.outputs.llmModelApiVersion
432-
azure_aoai_embedding_model: aoai.outputs.embeddingModel
433-
azure_aoai_embedding_model_deployment_name: aoai.outputs.embeddingModelDeploymentName
434-
azure_aoai_embedding_model_api_version: aoai.outputs.embeddingModelApiVersion
435-
azure_apim_gateway_url: apim.outputs.apimGatewayUrl
436-
azure_apim_name: apim.outputs.name
437-
azure_app_hostname: appHostname
438-
azure_app_url: appUrl
439-
azure_app_insights_connection_string: appInsights.outputs.connectionString
440-
azure_cosmosdb_endpoint: cosmosdb.outputs.endpoint
441-
azure_cosmosdb_name: cosmosdb.outputs.name
442-
azure_cosmosdb_id: cosmosdb.outputs.id
443-
azure_dns_zone_name: privateDnsZone.outputs.name
444-
azure_storage_account: storage.outputs.name
445-
azure_storage_account_blob_url: storage.outputs.primaryEndpoints.blob
446-
azure_workload_identity_client_id: workloadIdentity.outputs.clientId
447-
azure_workload_identity_principal_id: workloadIdentity.outputs.principalId
448-
azure_workload_identity_name: workloadIdentity.outputs.name
419+
aks_name: aks.outputs.name
420+
aks_service_account_name: aksServiceAccountName
421+
aoai_endpoint: aoai.outputs.endpoint
422+
aoai_llm_model: aoai.outputs.llmModel
423+
aoai_llm_model_deployment_name: aoai.outputs.llmModelDeploymentName
424+
aoai_llm_model_api_version: aoai.outputs.llmModelApiVersion
425+
aoai_embedding_model: aoai.outputs.embeddingModel
426+
aoai_embedding_model_deployment_name: aoai.outputs.embeddingModelDeploymentName
427+
aoai_embedding_model_api_version: aoai.outputs.embeddingModelApiVersion
428+
app_hostname: appHostname
429+
app_insights_connection_string: appInsights.outputs.connectionString
430+
cosmosdb_endpoint: cosmosdb.outputs.endpoint
449431
image_name: graphragImageName
450432
image_version: graphragImageVersion
451-
managed_identity_aks: aks.outputs.systemIdentity
433+
aks_managed_identity: aks.outputs.systemIdentity
434+
storage_account_blob_url: storage.outputs.primaryEndpoints.blob
435+
utcValue: utcString
436+
workload_identity_client_id: workloadIdentity.outputs.clientId
452437
}
453438
}
454439

0 commit comments

Comments
 (0)