@@ -36,7 +36,7 @@ param principalId string = ''
3636param openAILocation string
3737
3838@description ('Name of the OpenAI resource group. If not specified, the resource group name will be generated.' )
39- param openAIResourceGroupName string = existingResourceGroupName
39+ param openAIResourceGroupName string = ''
4040
4141@description ('Whether to deploy Azure OpenAI resources' )
4242param deployAzureOpenAI bool = true
@@ -71,7 +71,6 @@ var chatConfig = {
7171 deploymentCapacity : chatDeploymentCapacity != 0 ? chatDeploymentCapacity : 30
7272}
7373
74-
7574param embedModelName string = ''
7675param embedDeploymentName string = ''
7776param embedDeploymentVersion string = ''
@@ -97,7 +96,6 @@ resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing
9796 name : existingResourceGroupName
9897}
9998
100- // PostgreSQL Server
10199var postgresServerName = '${prefix }-postgresql'
102100var postgresDatabaseName = 'postgres'
103101var postgresEntraAdministratorObjectId = principalId
@@ -106,7 +104,7 @@ var postgresEntraAdministratorName = 'admin${uniqueString(resourceGroup.id, prin
106104
107105module postgresServer 'core/database/postgresql/flexibleserver.bicep' = {
108106 name : 'postgresql'
109- scope : existingResourceGroup
107+ scope : resourceGroup
110108 params : {
111109 name : postgresServerName
112110 location : location
@@ -131,7 +129,7 @@ module postgresServer 'core/database/postgresql/flexibleserver.bicep' = {
131129// Monitor application with Azure Monitor
132130module monitoring 'core/monitor/monitoring.bicep' = {
133131 name : 'monitoring'
134- scope : existingResourceGroup
132+ scope : resourceGroup
135133 params : {
136134 location : location
137135 tags : tags
@@ -144,7 +142,7 @@ module monitoring 'core/monitor/monitoring.bicep' = {
144142// Container apps host (including container registry)
145143module containerApps 'core/host/container-apps.bicep' = {
146144 name : 'container-apps'
147- scope : existingResourceGroup
145+ scope : resourceGroup
148146 params : {
149147 name : 'app'
150148 location : location
@@ -244,7 +242,7 @@ var secrets = !empty(azureOpenAIKey) ? {
244242
245243module web 'web.bicep' = {
246244 name : 'web'
247- scope : existingResourceGroup
245+ scope : resourceGroup
248246 params : {
249247 name : webAppName
250248 location : location
@@ -258,10 +256,14 @@ module web 'web.bicep' = {
258256 }
259257}
260258
259+ resource openAIResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing =
260+ if (!empty (openAIResourceGroupName )) {
261+ name : !empty (openAIResourceGroupName ) ? openAIResourceGroupName : resourceGroup .name
262+ }
261263
262264module openAI 'core/ai/cognitiveservices.bicep' = if (deployAzureOpenAI ) {
263265 name : 'openai'
264- scope : existingResourceGroup
266+ scope : openAIResourceGroup
265267 params : {
266268 name : '${prefix }-openai'
267269 location : openAILocation
@@ -302,7 +304,7 @@ module openAI 'core/ai/cognitiveservices.bicep' = if (deployAzureOpenAI) {
302304// USER ROLES
303305module openAIRoleUser 'core/security/role.bicep' =
304306 if (empty (runningOnGh )) {
305- scope : existingResourceGroup
307+ scope : openAIResourceGroup
306308 name : 'openai-role-user'
307309 params : {
308310 principalId : principalId
@@ -313,7 +315,7 @@ module openAIRoleUser 'core/security/role.bicep' =
313315
314316// Backend roles
315317module openAIRoleBackend 'core/security/role.bicep' = {
316- scope : existingResourceGroup
318+ scope : openAIResourceGroup
317319 name : 'openai-role-backend'
318320 params : {
319321 principalId : web .outputs .SERVICE_WEB_IDENTITY_PRINCIPAL_ID
0 commit comments