11@description ('Location for all resources.' )
2- param location string //Fixed for model availability, change back to resourceGroup().location
3-
2+ param location string = 'EastUS2' //Fixed for model availability, change back to resourceGroup().location
43
54@description ('Location for OpenAI resources.' )
65param azureOpenAILocation string = 'japaneast' //Fixed for model availability
76
87
98
109@description ('A prefix to add to the start of all resource names. Note: A "unique" suffix will also be added' )
11- param prefix string = take ( 'macaeo-${ uniqueString ( resourceGroup (). id )}' , 10 )
10+ param prefix string = 'macaeo'
1211
1312@description ('Tags to apply to all deployed resources' )
1413param tags object = {}
@@ -31,7 +30,7 @@ param resourceSize {
3130 maxReplicas : 1
3231 }
3332}
34- param capacity int = 1
33+ param capacity int = 10
3534
3635
3736var modelVersion = '2024-08-06'
@@ -142,33 +141,6 @@ module aifoundry 'deploy_ai_foundry.bicep' = {
142141 }
143142 scope : resourceGroup (resourceGroup ().name )
144143}
145- // resource openai 'Microsoft.CognitiveServices/accounts@2023-10-01-preview' = {
146- // name: format(uniqueNameFormat, 'openai')
147- // location: azureOpenAILocation
148- // tags: tags
149- // kind: 'OpenAI'
150- // sku: {
151- // name: 'S0'
152- // }
153- // properties: {
154- // customSubDomainName: format(uniqueNameFormat, 'openai')
155- // }
156- // resource gpt4o 'deployments' = {
157- // name: 'gpt-4o'
158- // sku: {
159- // name: 'GlobalStandard'
160- // capacity: resourceSize.gpt4oCapacity
161- // }
162- // properties: {
163- // model: {
164- // format: 'OpenAI'
165- // name: gptModelVersion
166- // version: '2024-08-06'
167- // }
168- // versionUpgradeOption: 'NoAutoUpgrade'
169- // }
170- // }
171- // }
172144
173145resource aoaiUserRoleDefinition 'Microsoft.Authorization/roleDefinitions@2022-05-01-preview' existing = {
174146 name : '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd' //'Cognitive Services OpenAI User'
@@ -339,6 +311,10 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
339311 name : 'AZURE_OPENAI_ENDPOINT'
340312 value : aiServices .properties .endpoint
341313 }
314+ {
315+ name : 'AZURE_OPENAI_MODEL_NAME'
316+ value : gptModelVersion
317+ }
342318 {
343319 name : 'AZURE_OPENAI_DEPLOYMENT_NAME'
344320 value : gptModelVersion
@@ -348,13 +324,34 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
348324 value : aoaiApiVersion
349325 }
350326 {
351- name : 'FRONTEND_SITE_NAME '
352- value : 'https://${ format ( uniqueNameFormat , 'frontend' )}.azurewebsites.net'
327+ name : 'APPLICATIONINSIGHTS_INSTRUMENTATION_KEY '
328+ value : appInsights . properties . InstrumentationKey
353329 }
354330 {
355331 name : 'APPLICATIONINSIGHTS_CONNECTION_STRING'
356332 value : appInsights .properties .ConnectionString
357333 }
334+ {
335+ name : 'AZURE_AI_AGENT_PROJECT_CONNECTION_STRING'
336+ value : aifoundry .outputs .projectConnectionString
337+ }
338+ {
339+ name : 'AZURE_AI_SUBSCRIPTION_ID'
340+ value : subscription ().subscriptionId
341+ }
342+ {
343+ name : 'AZURE_AI_RESOURCE_GROUP'
344+ value : resourceGroup ().name
345+ }
346+ {
347+ name : 'AZURE_AI_PROJECT_NAME'
348+ value : aifoundry .outputs .aiProjectName
349+ }
350+ {
351+ name : 'FRONTEND_SITE_NAME'
352+ value : 'https://${format (uniqueNameFormat , 'frontend' )}.azurewebsites.net'
353+ }
354+
358355 ]
359356 }
360357 ]
@@ -417,6 +414,23 @@ resource frontendAppService 'Microsoft.Web/sites@2021-02-01' = {
417414 }
418415}
419416
417+ resource aiHubProject 'Microsoft.MachineLearningServices/workspaces@2024-01-01-preview' existing = {
418+ name : '${prefix }-aiproject' // aiProjectName must be calculated - available at main start.
419+ }
420+
421+ resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
422+ name : '64702f94-c441-49e6-a78b-ef80e0188fee'
423+ }
424+
425+ resource aiDeveloperAccessProj 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
426+ name : guid (containerApp .name , aiHubProject .id , aiDeveloper .id )
427+ scope : aiHubProject
428+ properties : {
429+ roleDefinitionId : aiDeveloper .id
430+ principalId : containerApp .identity .principalId
431+ }
432+ }
433+
420434var cosmosAssignCli = 'az cosmosdb sql role assignment create --resource-group "${resourceGroup ().name }" --account-name "${cosmos .name }" --role-definition-id "${cosmos ::contributorRoleDefinition .id }" --scope "${cosmos .id }" --principal-id "${containerApp .identity .principalId }"'
421435
422436module managedIdentityModule 'deploy_managed_identity.bicep' = {
0 commit comments