Skip to content

Commit 527886a

Browse files
committed
fixes to params and addition of env vars and RBAC
1 parent e4a92f5 commit 527886a

File tree

3 files changed

+82
-51
lines changed

3 files changed

+82
-51
lines changed

azure.yaml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json
2-
environment:
3-
name: multi-agent-custom-automation-engine-solution-accelerator
4-
location: eastus
52
name: multi-agent-custom-automation-engine-solution-accelerator
6-
# metadata:
7-
# template: [email protected]
8-
parameters:
9-
baseUrl:
10-
type: string
11-
default: 'https://github.com/TravisHilbert/Modernize-your-code-solution-accelerator'
12-
deployment:
13-
mode: Incremental
14-
template: ./infra/main.bicep # Path to the main.bicep file inside the 'deployment' folder
3+

infra/deploy_ai_foundry.bicep

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,5 @@ output storageAccountName string = storageNameCleaned
298298

299299
output logAnalyticsId string = logAnalytics.id
300300
output storageAccountId string = storage.id
301+
302+
output projectConnectionString string = '${split(aiHubProject.properties.discoveryUrl, '/')[2]};${subscription().subscriptionId};${resourceGroup().name};${aiHubProject.name}'

infra/main.bicep

Lines changed: 79 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
11
@description('Location for all resources.')
2-
param location string = 'EastUS2' //Fixed for model availability, change back to resourceGroup().location
3-
4-
@description('Location for OpenAI resources.')
5-
param azureOpenAILocation string = 'japaneast' //Fixed for model availability
6-
7-
8-
9-
@description('A prefix to add to the start of all resource names. Note: A "unique" suffix will also be added')
10-
param prefix string = 'macaeo'
2+
param location string
3+
4+
@allowed([
5+
'australiaeast'
6+
'brazilsouth'
7+
'canadacentral'
8+
'canadaeast'
9+
'eastus'
10+
'eastus2'
11+
'francecentral'
12+
'germanywestcentral'
13+
'japaneast'
14+
'koreacentral'
15+
'northcentralus'
16+
'norwayeast'
17+
'polandcentral'
18+
'southafricanorth'
19+
'southcentralus'
20+
'southindia'
21+
'swedencentral'
22+
'switzerlandnorth'
23+
'uaenorth'
24+
'uksouth'
25+
'westeurope'
26+
'westus'
27+
'westus3'
28+
])
29+
@description('Location for all Ai services resources. This location can be different from the resource group location.')
30+
param azureOpenAILocation string // The location used for all deployed resources. This location must be in the same region as the resource group.
31+
32+
@minLength(3)
33+
@maxLength(20)
34+
@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.')
35+
param prefix string
1136

1237
@description('Tags to apply to all deployed resources')
1338
param tags object = {}
@@ -30,7 +55,7 @@ param resourceSize {
3055
maxReplicas: 1
3156
}
3257
}
33-
param capacity int = 1
58+
param capacity int = 10
3459

3560

3661
var modelVersion = '2024-08-06'
@@ -141,33 +166,6 @@ module aifoundry 'deploy_ai_foundry.bicep' = {
141166
}
142167
scope: resourceGroup(resourceGroup().name)
143168
}
144-
// resource openai 'Microsoft.CognitiveServices/accounts@2023-10-01-preview' = {
145-
// name: format(uniqueNameFormat, 'openai')
146-
// location: azureOpenAILocation
147-
// tags: tags
148-
// kind: 'OpenAI'
149-
// sku: {
150-
// name: 'S0'
151-
// }
152-
// properties: {
153-
// customSubDomainName: format(uniqueNameFormat, 'openai')
154-
// }
155-
// resource gpt4o 'deployments' = {
156-
// name: 'gpt-4o'
157-
// sku: {
158-
// name: 'GlobalStandard'
159-
// capacity: resourceSize.gpt4oCapacity
160-
// }
161-
// properties: {
162-
// model: {
163-
// format: 'OpenAI'
164-
// name: gptModelVersion
165-
// version: '2024-08-06'
166-
// }
167-
// versionUpgradeOption: 'NoAutoUpgrade'
168-
// }
169-
// }
170-
// }
171169

172170
resource aoaiUserRoleDefinition 'Microsoft.Authorization/roleDefinitions@2022-05-01-preview' existing = {
173171
name: '5e0bd9bd-7b93-4f28-af87-19fc36ad61bd' //'Cognitive Services OpenAI User'
@@ -338,6 +336,10 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
338336
name: 'AZURE_OPENAI_ENDPOINT'
339337
value: aiServices.properties.endpoint
340338
}
339+
{
340+
name: 'AZURE_OPENAI_MODEL_NAME'
341+
value: gptModelVersion
342+
}
341343
{
342344
name: 'AZURE_OPENAI_DEPLOYMENT_NAME'
343345
value: gptModelVersion
@@ -347,13 +349,34 @@ resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
347349
value: aoaiApiVersion
348350
}
349351
{
350-
name: 'FRONTEND_SITE_NAME'
351-
value: 'https://${format(uniqueNameFormat, 'frontend')}.azurewebsites.net'
352+
name: 'APPLICATIONINSIGHTS_INSTRUMENTATION_KEY'
353+
value: appInsights.properties.InstrumentationKey
352354
}
353355
{
354356
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
355357
value: appInsights.properties.ConnectionString
356358
}
359+
{
360+
name: 'AZURE_AI_AGENT_PROJECT_CONNECTION_STRING'
361+
value: aifoundry.outputs.projectConnectionString
362+
}
363+
{
364+
name: 'AZURE_AI_SUBSCRIPTION_ID'
365+
value: subscription().subscriptionId
366+
}
367+
{
368+
name: 'AZURE_AI_RESOURCE_GROUP'
369+
value: resourceGroup().name
370+
}
371+
{
372+
name: 'AZURE_AI_PROJECT_NAME'
373+
value: aifoundry.outputs.aiProjectName
374+
}
375+
{
376+
name: 'FRONTEND_SITE_NAME'
377+
value: 'https://${format(uniqueNameFormat, 'frontend')}.azurewebsites.net'
378+
}
379+
357380
]
358381
}
359382
]
@@ -416,6 +439,23 @@ resource frontendAppService 'Microsoft.Web/sites@2021-02-01' = {
416439
}
417440
}
418441

442+
resource aiHubProject 'Microsoft.MachineLearningServices/workspaces@2024-01-01-preview' existing = {
443+
name: '${prefix}-aiproject' // aiProjectName must be calculated - available at main start.
444+
}
445+
446+
resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
447+
name: '64702f94-c441-49e6-a78b-ef80e0188fee'
448+
}
449+
450+
resource aiDeveloperAccessProj 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
451+
name: guid(containerApp.name, aiHubProject.id, aiDeveloper.id)
452+
scope: aiHubProject
453+
properties: {
454+
roleDefinitionId: aiDeveloper.id
455+
principalId: containerApp.identity.principalId
456+
}
457+
}
458+
419459
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}"'
420460

421461
module managedIdentityModule 'deploy_managed_identity.bicep' = {

0 commit comments

Comments
 (0)