Skip to content

Commit 1cbee90

Browse files
committed
Added param file for main
1 parent 7c56aec commit 1cbee90

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

infra/main.bicep

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
targetScope = 'resourceGroup'
2-
@description('Location for all resources.')
3-
param location string
2+
// @description('Location for all resources.')
3+
// param location string
44

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

3333
@minLength(3)
3434
@maxLength(20)
35-
@description('A unique prefix for all resources in this deployment. This should be 3-20 characters long:')
36-
param environmentName string
37-
38-
var uniqueId = toLower(uniqueString(subscription().id, environmentName, resourceGroup().location))
39-
var solutionPrefix = 'ma${padLeft(take(uniqueId, 12), 12, '0')}'
35+
@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 //= 'macae'
4037

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

61+
var location = resourceGroup().location
6462
var modelVersion = '2024-08-06'
65-
var aiServicesName = '${solutionPrefix}-aiservices'
63+
var aiServicesName = '${prefix}-aiservices'
6664
var deploymentType = 'GlobalStandard'
6765
var gptModelVersion = 'gpt-4o'
6866
var appVersion = 'fnd01'
@@ -73,7 +71,7 @@ var dockerRegistryUrl = 'https://${resgistryName}.azurecr.io'
7371
var backendDockerImageURL = '${resgistryName}.azurecr.io/macaebackend:${appVersion}'
7472
var frontendDockerImageURL = '${resgistryName}.azurecr.io/macaefrontend:${appVersion}'
7573

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

7977
resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
@@ -123,7 +121,7 @@ resource aiServices 'Microsoft.CognitiveServices/accounts@2024-04-01-preview' =
123121
apiProperties: {
124122
//statisticsEnabled: false
125123
}
126-
//disableLocalAuth: true
124+
disableLocalAuth: true
127125
}
128126
}
129127

@@ -149,7 +147,7 @@ resource aiServicesDeployments 'Microsoft.CognitiveServices/accounts/deployments
149147
module kvault 'deploy_keyvault.bicep' = {
150148
name: 'deploy_keyvault'
151149
params: {
152-
solutionName: solutionPrefix
150+
solutionName: prefix
153151
solutionLocation: location
154152
managedIdentityObjectId: managedIdentityModule.outputs.managedIdentityOutput.objectId
155153
}
@@ -163,7 +161,7 @@ module kvault 'deploy_keyvault.bicep' = {
163161
module aifoundry 'deploy_ai_foundry.bicep' = {
164162
name: 'deploy_ai_foundry'
165163
params: {
166-
solutionName: solutionPrefix
164+
solutionName: prefix
167165
solutionLocation: azureOpenAILocation
168166
keyVaultName: kvault.outputs.keyvaultName
169167
gptModelName: gptModelVersion
@@ -205,7 +203,7 @@ resource cosmos 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
205203
}
206204
]
207205
capabilities: [{ name: 'EnableServerless' }]
208-
//disableLocalAuth: true
206+
disableLocalAuth: true
209207
}
210208

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

280278
@description('')
281279
resource containerApp 'Microsoft.App/containerApps@2024-03-01' = {
282-
name: '${solutionPrefix}-backend'
280+
name: '${prefix}-backend'
283281
location: location
284282
tags: tags
285283
identity: {
@@ -448,7 +446,7 @@ resource frontendAppService 'Microsoft.Web/sites@2021-02-01' = {
448446
}
449447

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

454452
resource aiDeveloper 'Microsoft.Authorization/roleDefinitions@2022-04-01' existing = {
@@ -469,7 +467,7 @@ var cosmosAssignCli = 'az cosmosdb sql role assignment create --resource-group "
469467
module managedIdentityModule 'deploy_managed_identity.bicep' = {
470468
name: 'deploy_managed_identity'
471469
params: {
472-
solutionName: solutionPrefix
470+
solutionName: prefix
473471
//solutionLocation: location
474472
managedIdentityId: pullIdentity.id
475473
managedIdentityPropPrin: pullIdentity.properties.principalId

infra/main.bicepparam

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
using './main.bicep'
2+
3+
param azureOpenAILocation = readEnvironmentVariable('AZURE_LOCATION','japaneast')
4+
param prefix = readEnvironmentVariable('AZURE_ENV_NAME','azdtemp')

0 commit comments

Comments
 (0)