diff --git a/.github/workflows/deploy-waf.yml b/.github/workflows/deploy-waf.yml index 0b567ff6..8ec0a5e1 100644 --- a/.github/workflows/deploy-waf.yml +++ b/.github/workflows/deploy-waf.yml @@ -92,6 +92,15 @@ jobs: echo "Resource group already exists." fi + - name: Generate Unique Solution Prefix + id: generate_solution_prefix + run: | + COMMON_PART="macae" + TIMESTAMP=$(date +%s) + UPDATED_TIMESTAMP=$(echo $TIMESTAMP | tail -c 6) + UNIQUE_SOLUTION_PREFIX="${COMMON_PART}${UPDATED_TIMESTAMP}" + echo "SOLUTION_PREFIX=${UNIQUE_SOLUTION_PREFIX}" >> $GITHUB_ENV + - name: Deploy Bicep Template id: deploy run: | @@ -100,6 +109,7 @@ jobs: --resource-group ${{ env.RESOURCE_GROUP_NAME }} \ --template-file infra/main.bicep \ --parameters \ + environmentName=${{ env.SOLUTION_PREFIX }} \ useWafAlignedArchitecture=true \ aiDeploymentsLocation='${{ env.AZURE_LOCATION }}' \ gptModelCapacity=5 \ diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5f81962c..747d8de5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -129,7 +129,7 @@ jobs: --resource-group ${{ env.RESOURCE_GROUP_NAME }} \ --template-file infra/main.bicep \ --parameters \ - solutionPrefix=${{ env.SOLUTION_PREFIX }} \ + environmentName=${{ env.SOLUTION_PREFIX }} \ solutionLocation="${{ env.AZURE_LOCATION }}" \ modelDeploymentType="GlobalStandard" \ gptModelName="gpt-4o" \ diff --git a/infra/main.bicep b/infra/main.bicep index f763ae54..ec3d16c9 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -7,9 +7,8 @@ param useWafAlignedArchitecture bool @description('Use this parameter to use an existing AI project resource ID') param existingFoundryProjectResourceId string = '' -@description('Optional. The prefix to add in the default names given to all deployed Azure resources.') -@maxLength(19) -param solutionPrefix string = 'macae${uniqueString(deployer().objectId, deployer().tenantId, subscription().subscriptionId, resourceGroup().id)}' +@description('Required. Name of the environment to deploy the solution into.') +param environmentName string @description('Required. Location for all Resources except AI Foundry.') param solutionLocation string = resourceGroup().location @@ -48,6 +47,8 @@ param gptModelCapacity int = 150 @description('Set the image tag for the container images used in the solution. Default is "latest".') param imageTag string = 'latest' +param solutionPrefix string = 'macae-${padLeft(take(toLower(uniqueString(subscription().id, environmentName, resourceGroup().location)), 12), 12, '0')}' + @description('Optional. The tags to apply to all deployed Azure resources.') param tags object = { app: solutionPrefix @@ -616,6 +617,7 @@ module bastionHost 'br/public:avm/res/network/bastion-host:0.6.1' = if (virtualN virtualNetworkResourceId: bastionConfiguration.?virtualNetworkResourceId ?? virtualNetwork.?outputs.?resourceId publicIPAddressObject: { name: bastionConfiguration.?publicIpResourceName ?? 'pip-bas${solutionPrefix}' + zones: [] } disableCopyPaste: false enableFileCopy: false @@ -662,7 +664,7 @@ module virtualMachine 'br/public:avm/res/compute/virtual-machine:0.13.0' = if (v name: 'osdisk-${virtualMachineResourceName}' createOption: 'FromImage' managedDisk: { - storageAccountType: 'Premium_ZRS' + storageAccountType: 'Standard_LRS' } diskSizeGB: 128 caching: 'ReadWrite' diff --git a/infra/main.parameters.json b/infra/main.parameters.json index 5a22eb38..16b46561 100644 --- a/infra/main.parameters.json +++ b/infra/main.parameters.json @@ -18,7 +18,7 @@ } ] }, - "solutionPrefix": { + "environmentName": { "value": "${AZURE_ENV_NAME}" }, "solutionLocation": {