Skip to content
Closed
Show file tree
Hide file tree
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
32 changes: 15 additions & 17 deletions infra/main.bicep
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
targetScope = 'resourceGroup'
@description('Location for all resources.')
param location string
// @description('Location for all resources.')
// param location string

@allowed([
'australiaeast'
Expand Down Expand Up @@ -28,15 +28,12 @@ param location string
'westus3'
])
@description('Location for all Ai services resources. This location can be different from the resource group location.')
param azureOpenAILocation string = 'eastus2' // The location used for all deployed resources. This location must be in the same region as the resource group.
param azureOpenAILocation string //= 'eastus2' // The location used for all deployed resources. This location must be in the same region as the resource group.

@minLength(3)
@maxLength(20)
@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('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 //= 'macae'

@description('Tags to apply to all deployed resources')
param tags object = {}
Expand All @@ -61,8 +58,9 @@ param resourceSize {
}
param capacity int = 140

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

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

resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
Expand Down Expand Up @@ -123,7 +121,7 @@ resource aiServices 'Microsoft.CognitiveServices/accounts@2024-04-01-preview' =
apiProperties: {
//statisticsEnabled: false
}
//disableLocalAuth: true
disableLocalAuth: true
}
}

Expand All @@ -149,7 +147,7 @@ resource aiServicesDeployments 'Microsoft.CognitiveServices/accounts/deployments
module kvault 'deploy_keyvault.bicep' = {
name: 'deploy_keyvault'
params: {
solutionName: solutionPrefix
solutionName: prefix
solutionLocation: location
managedIdentityObjectId: managedIdentityModule.outputs.managedIdentityOutput.objectId
}
Expand All @@ -163,7 +161,7 @@ module kvault 'deploy_keyvault.bicep' = {
module aifoundry 'deploy_ai_foundry.bicep' = {
name: 'deploy_ai_foundry'
params: {
solutionName: solutionPrefix
solutionName: prefix
solutionLocation: azureOpenAILocation
keyVaultName: kvault.outputs.keyvaultName
gptModelName: gptModelVersion
Expand Down Expand Up @@ -205,7 +203,7 @@ resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
}
]
capabilities: [{ name: 'EnableServerless' }]
//disableLocalAuth: true
disableLocalAuth: true
}

resource contributorRoleDefinition 'sqlRoleDefinitions' existing = {
Expand Down Expand Up @@ -279,7 +277,7 @@ resource acaCosomsRoleAssignment 'Microsoft.DocumentDB/databaseAccounts/sqlRoleA

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

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

resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
Expand All @@ -469,7 +467,7 @@ var cosmosAssignCli = 'az cosmosdb sql role assignment create --resource-group "
module managedIdentityModule 'deploy_managed_identity.bicep' = {
name: 'deploy_managed_identity'
params: {
solutionName: solutionPrefix
solutionName: prefix
//solutionLocation: location
managedIdentityId: pullIdentity.id
managedIdentityPropPrin: pullIdentity.properties.principalId
Expand Down
4 changes: 4 additions & 0 deletions infra/main.bicepparam
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using './main.bicep'

param azureOpenAILocation = readEnvironmentVariable('AZURE_LOCATION','japaneast')
param prefix = readEnvironmentVariable('AZURE_ENV_NAME','azdtemp')
Loading