Skip to content

Commit 75ecf36

Browse files
authored
Merge pull request #165 from Fr4nc3/main
last conflict
2 parents 2497292 + e5f88f5 commit 75ecf36

File tree

1 file changed

+33
-35
lines changed

1 file changed

+33
-35
lines changed

infra/main.bicep

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
targetScope = 'resourceGroup'
22
@description('Location for all resources.')
3-
param location string = 'EastUS2' //Fixed for model availability, change back to resourceGroup().location
3+
param location string
44

55
@allowed([
66
'australiaeast'
@@ -33,7 +33,7 @@ param azureOpenAILocation string = 'eastus2' // The location used for all deploy
3333
@minLength(3)
3434
@maxLength(20)
3535
@description('Prefix for all resources created by this template. This prefix will be used to create unique names for all resources. The prefix must be unique within the resource group.')
36-
param prefix string = take('macaeo-${uniqueString(resourceGroup().id)}', 10)
36+
param prefix string
3737

3838
@description('Tags to apply to all deployed resources')
3939
param tags object = {}
@@ -56,12 +56,11 @@ param resourceSize {
5656
maxReplicas: 1
5757
}
5858
}
59-
param capacity int = 10
60-
59+
param capacity int = 40
6160

6261
var modelVersion = '2024-08-06'
6362
var aiServicesName = '${prefix}-aiservices'
64-
var deploymentType = 'GlobalStandard'
63+
var deploymentType = 'GlobalStandard'
6564
var gptModelVersion = 'gpt-4o'
6665
var appVersion = 'fnd01'
6766
var resgistryName = 'biabcontainerreg'
@@ -72,7 +71,7 @@ var backendDockerImageURL = '${resgistryName}.azurecr.io/macaebackend:${appVersi
7271
var frontendDockerImageURL = '${resgistryName}.azurecr.io/macaefrontend:${appVersion}'
7372

7473
var uniqueNameFormat = '${prefix}-{0}-${uniqueString(resourceGroup().id, prefix)}'
75-
var aoaiApiVersion = '2024-08-01-preview'
74+
var aoaiApiVersion = '2025-01-01-preview'
7675

7776
resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
7877
name: format(uniqueNameFormat, 'logs')
@@ -96,7 +95,6 @@ resource appInsights 'Microsoft.Insights/components@2020-02-02-preview' = {
9695
}
9796
}
9897

99-
10098
var aiModelDeployments = [
10199
{
102100
name: gptModelVersion
@@ -120,34 +118,36 @@ resource aiServices 'Microsoft.CognitiveServices/accounts@2024-04-01-preview' =
120118
properties: {
121119
customSubDomainName: aiServicesName
122120
apiProperties: {
123-
statisticsEnabled: false
121+
//statisticsEnabled: false
124122
}
125123
}
126124
}
127125

128-
resource aiServicesDeployments 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = [for aiModeldeployment in aiModelDeployments: {
129-
parent: aiServices //aiServices_m
130-
name: aiModeldeployment.name
131-
properties: {
132-
model: {
133-
format: 'OpenAI'
134-
name: aiModeldeployment.model
135-
version: aiModeldeployment.version
126+
resource aiServicesDeployments 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = [
127+
for aiModeldeployment in aiModelDeployments: {
128+
parent: aiServices //aiServices_m
129+
name: aiModeldeployment.name
130+
properties: {
131+
model: {
132+
format: 'OpenAI'
133+
name: aiModeldeployment.model
134+
version: aiModeldeployment.version
135+
}
136+
raiPolicyName: aiModeldeployment.raiPolicyName
137+
}
138+
sku: {
139+
name: aiModeldeployment.sku.name
140+
capacity: aiModeldeployment.sku.capacity
136141
}
137-
raiPolicyName: aiModeldeployment.raiPolicyName
138-
}
139-
sku:{
140-
name: aiModeldeployment.sku.name
141-
capacity: aiModeldeployment.sku.capacity
142142
}
143-
}]
143+
]
144144

145145
module kvault 'deploy_keyvault.bicep' = {
146146
name: 'deploy_keyvault'
147147
params: {
148148
solutionName: prefix
149149
solutionLocation: location
150-
managedIdentityObjectId:managedIdentityModule.outputs.managedIdentityOutput.objectId
150+
managedIdentityObjectId: managedIdentityModule.outputs.managedIdentityOutput.objectId
151151
}
152152
scope: resourceGroup(resourceGroup().name)
153153
}
@@ -160,7 +160,7 @@ module aifoundry 'deploy_ai_foundry.bicep' = {
160160
keyVaultName: kvault.outputs.keyvaultName
161161
gptModelName: gptModelVersion
162162
gptModelVersion: gptModelVersion
163-
managedIdentityObjectId:managedIdentityModule.outputs.managedIdentityOutput.objectId
163+
managedIdentityObjectId: managedIdentityModule.outputs.managedIdentityOutput.objectId
164164
aiServicesEndpoint: aiServices.properties.endpoint
165165
aiServicesKey: aiServices.listKeys().key1
166166
aiServicesId: aiServices.id
@@ -196,7 +196,7 @@ resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
196196
locationName: location
197197
}
198198
]
199-
capabilities: [ { name: 'EnableServerless' } ]
199+
capabilities: [{ name: 'EnableServerless' }]
200200
}
201201

202202
resource contributorRoleDefinition 'sqlRoleDefinitions' existing = {
@@ -231,14 +231,11 @@ resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
231231
}
232232
// Define existing ACR resource
233233

234-
235234
resource pullIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-07-31-preview' = {
236235
name: format(uniqueNameFormat, 'containerapp-pull')
237236
location: location
238237
}
239238

240-
241-
242239
resource containerAppEnv 'Microsoft.App/managedEnvironments@2024-03-01' = {
243240
name: format(uniqueNameFormat, 'containerapp')
244241
location: location
@@ -335,7 +332,7 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
335332
}
336333
{
337334
name: 'AZURE_OPENAI_ENDPOINT'
338-
value: aiServices.properties.endpoint
335+
value: replace(aiServices.properties.endpoint, 'cognitiveservices.azure.com', 'openai.azure.com')
339336
}
340337
{
341338
name: 'AZURE_OPENAI_MODEL_NAME'
@@ -377,15 +374,12 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
377374
name: 'FRONTEND_SITE_NAME'
378375
value: 'https://${format(uniqueNameFormat, 'frontend')}.azurewebsites.net'
379376
}
380-
381377
]
382378
}
383379
]
384380
}
385-
386-
}
387-
388381
}
382+
}
389383
resource frontendAppServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {
390384
name: format(uniqueNameFormat, 'frontend-plan')
391385
location: location
@@ -398,7 +392,7 @@ resource frontendAppServicePlan 'Microsoft.Web/serverfarms@2021-02-01' = {
398392
properties: {
399393
reserved: true
400394
}
401-
kind: 'linux' // Add this line to support Linux containers
395+
kind: 'linux' // Add this line to support Linux containers
402396
}
403397

404398
resource frontendAppService 'Microsoft.Web/sites@2021-02-01' = {
@@ -428,6 +422,10 @@ resource frontendAppService 'Microsoft.Web/sites@2021-02-01' = {
428422
name: 'BACKEND_API_URL'
429423
value: 'https://${containerApp.properties.configuration.ingress.fqdn}'
430424
}
425+
{
426+
name: 'AUTH_ENABLED'
427+
value: 'false'
428+
}
431429
]
432430
}
433431
}
@@ -457,7 +455,7 @@ resource aiDeveloperAccessProj 'Microsoft.Authorization/roleAssignments@2022-04-
457455
}
458456
}
459457

460-
var 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}"'
458+
var 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}"'
461459

462460
module managedIdentityModule 'deploy_managed_identity.bicep' = {
463461
name: 'deploy_managed_identity'

0 commit comments

Comments
 (0)