Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ param azureOpenAILocation string = 'eastus2' // The location used for all deploy

@minLength(3)
@maxLength(20)
@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.')
param prefix string = toLower(uniqueString(subscription().id, resourceGroup().location))
@description('A unique prefix for all resources in this deployment. This should be 3-20 characters long:')
param environmentName string

var uniqueId = toLower(uniqueString(subscription().id, environmentName, resourceGroup().location))
var solutionPrefix = 'ma${padLeft(take(uniqueId, 12), 12, '0')}'

@description('Tags to apply to all deployed resources')
param tags object = {}
Expand All @@ -59,7 +62,7 @@ param resourceSize {
param capacity int = 140

var modelVersion = '2024-08-06'
var aiServicesName = '${prefix}-aiservices'
var aiServicesName = '${solutionPrefix}-aiservices'
var deploymentType = 'GlobalStandard'
var gptModelVersion = 'gpt-4o'
var appVersion = 'fnd01'
Expand All @@ -70,7 +73,7 @@ var dockerRegistryUrl = 'https://${resgistryName}.azurecr.io'
var backendDockerImageURL = '${resgistryName}.azurecr.io/macaebackend:${appVersion}'
var frontendDockerImageURL = '${resgistryName}.azurecr.io/macaefrontend:${appVersion}'

var uniqueNameFormat = '${prefix}-{0}-${uniqueString(resourceGroup().id, prefix)}'
var uniqueNameFormat = '${solutionPrefix}-{0}-${uniqueString(resourceGroup().id, solutionPrefix)}'
var aoaiApiVersion = '2025-01-01-preview'

resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
Expand Down Expand Up @@ -146,7 +149,7 @@ resource aiServicesDeployments 'Microsoft.CognitiveServices/accounts/deployments
module kvault 'deploy_keyvault.bicep' = {
name: 'deploy_keyvault'
params: {
solutionName: prefix
solutionName: solutionPrefix
solutionLocation: location
managedIdentityObjectId: managedIdentityModule.outputs.managedIdentityOutput.objectId
}
Expand All @@ -160,7 +163,7 @@ module kvault 'deploy_keyvault.bicep' = {
module aifoundry 'deploy_ai_foundry.bicep' = {
name: 'deploy_ai_foundry'
params: {
solutionName: prefix
solutionName: solutionPrefix
solutionLocation: azureOpenAILocation
keyVaultName: kvault.outputs.keyvaultName
gptModelName: gptModelVersion
Expand Down Expand Up @@ -276,7 +279,7 @@ resource acaCosomsRoleAssignment 'Microsoft.DocumentDB/databaseAccounts/sqlRoleA

@description('')
resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
name: '${prefix}-backend'
name: '${solutionPrefix}-backend'
location: location
tags: tags
identity: {
Expand Down Expand Up @@ -445,7 +448,7 @@ resource frontendAppService 'Microsoft.Web/sites@2021-02-01' = {
}

resource aiHubProject 'Microsoft.MachineLearningServices/workspaces@2024-01-01-preview' existing = {
name: '${prefix}-aiproject' // aiProjectName must be calculated - available at main start.
name: '${solutionPrefix}-aiproject' // aiProjectName must be calculated - available at main start.
}

resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
Expand All @@ -466,7 +469,7 @@ var cosmosAssignCli = 'az cosmosdb sql role assignment create --resource-group "
module managedIdentityModule 'deploy_managed_identity.bicep' = {
name: 'deploy_managed_identity'
params: {
solutionName: prefix
solutionName: solutionPrefix
//solutionLocation: location
managedIdentityId: pullIdentity.id
managedIdentityPropPrin: pullIdentity.properties.principalId
Expand Down
Loading