Skip to content

Commit fbfcdf1

Browse files
Merge pull request #255 from microsoft/psl-us18890-vs
feat: Standardize Bicep Parameters for MACAE
2 parents 421b6e7 + 4782a3e commit fbfcdf1

File tree

5 files changed

+77
-16
lines changed

5 files changed

+77
-16
lines changed

docs/CustomizingAzdParameters.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## [Optional]: Customizing resource names
2+
3+
By default this template will use the environment name as the prefix to prevent naming collisions within Azure. The parameters below show the default values. You only need to run the statements below if you need to change the values.
4+
5+
> To override any of the parameters, run `azd env set <PARAMETER_NAME> <VALUE>` before running `azd up`. On the first azd command, it will prompt you for the environment name. Be sure to choose 3-20 characters alphanumeric unique name.
6+
7+
## Parameters
8+
9+
| Name | Type | Default Value | Purpose |
10+
| ------------------------------- | ------ | ----------------- | --------------------------------------------------------------------------------------------------- |
11+
| `AZURE_ENV_NAME` | string | `macae` | Used as a prefix for all resource names to ensure uniqueness across environments. |
12+
| `AZURE_LOCATION` | string | `swedencentral` | Location of the Azure resources. Controls where the infrastructure will be deployed. |
13+
| `AZURE_ENV_OPENAI_LOCATION` | string | `swedencentral` | Specifies the region for OpenAI resource deployment. |
14+
| `AZURE_ENV_MODEL_DEPLOYMENT_TYPE` | string | `GlobalStandard` | Defines the deployment type for the AI model (e.g., Standard, GlobalStandard). |
15+
| `AZURE_ENV_MODEL_NAME` | string | `gpt-4o` | Specifies the name of the GPT model to be deployed. |
16+
| `AZURE_ENV_MODEL_VERSION` | string | `2024-08-06` | Version of the GPT model to be used for deployment. |
17+
| `AZURE_ENV_IMAGETAG` | string | `latest` | Docker image tag used for container deployments. |
18+
| `AZURE_ENV_ENABLE_TELEMETRY` | bool | `true` | Enables telemetry for monitoring and diagnostics. |
19+
20+
---
21+
22+
## How to Set a Parameter
23+
24+
To customize any of the above values, run the following command **before** `azd up`:
25+
26+
```bash
27+
azd env set <PARAMETER_NAME> <VALUE>
28+
```
29+
30+
**Example:**
31+
32+
```bash
33+
azd env set AZURE_LOCATION westus2
34+
```

docs/DeploymentGuide.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,19 @@ Consider the following settings during your deployment to modify specific settin
134134
<details>
135135
<summary><b>Configurable Deployment Settings</b></summary>
136136

137-
When you start the deployment, most parameters will have **default values**, but you can update the following settings:
138-
139-
| **Setting** | **Description** | **Default value** |
140-
| --------------------------------- | ------------------------------------------------------------------------------------------- | ----------------- |
141-
| **Azure Region** | The region where resources will be created. | East US |
142-
| **Secondary Location** | A **less busy** region for **Azure Cosmos DB**, useful in case of availability constraints. | eastus2 |
143-
| **Deployment Type** | Select from a drop-down list. | GlobalStandard |
144-
| **GPT Model** | Choose from **gpt-4, gpt-4o, gpt-4o-mini**. | gpt-4o |
145-
| **GPT Model Deployment Capacity** | Configure capacity for **GPT models**. | 140k |
137+
When you start the deployment, most parameters will have **default values**, but you can update the following settings [here](../docs/CustomizingAzdParameters.md):
138+
139+
| **Setting** | **Description** | **Default value** |
140+
| ------------------------------ | ------------------------------------------------------------------------------------ | ----------------- |
141+
| **Environment Name** | Used as a prefix for all resource names to ensure uniqueness across environments. | macae |
142+
| **Azure Region** | Location of the Azure resources. Controls where the infrastructure will be deployed. | swedencentral |
143+
| **OpenAI Deployment Location** | Specifies the region for OpenAI resource deployment. | swedencentral |
144+
| **Model Deployment Type** | Defines the deployment type for the AI model (e.g., Standard, GlobalStandard). | GlobalStandard |
145+
| **GPT Model Name** | Specifies the name of the GPT model to be deployed. | gpt-4o |
146+
| **GPT Model Version** | Version of the GPT model to be used for deployment. | 2024-08-06 |
147+
| **Image Tag** | Docker image tag used for container deployments. | latest |
148+
| **Enable Telemetry** | Enables telemetry for monitoring and diagnostics. | true |
149+
146150

147151
</details>
148152

infra/main.bicep

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ param enableTelemetry bool = true
1616
@description('Azure OpenAI Location')
1717
param azureOpenAILocation string
1818

19+
@minLength(1)
20+
@description('Name of the GPT model to deploy:')
21+
param gptModelName string = 'gpt-4o'
22+
23+
param gptModelVersion string = '2024-08-06'
24+
25+
@minLength(1)
26+
@description('GPT model deployment type:')
27+
param modelDeploymentType string = 'GlobalStandard'
28+
29+
@description('Set the image tag for the container images used in the solution. Default is "latest".')
30+
param imageTag string = 'latest'
31+
1932
// @description('Set this if you want to deploy to a different region than the resource group. Otherwise, it will use the resource group location by default.')
2033
// param AZURE_LOCATION string=''
2134
// param solutionLocation string = empty(AZURE_LOCATION) ? resourceGroup().location
@@ -194,7 +207,7 @@ param containerAppConfiguration containerAppConfigurationType = {
194207
containerMemory: '4.0Gi'
195208
containerImageRegistryDomain: 'biabcontainerreg.azurecr.io'
196209
containerImageName: 'macaebackend'
197-
containerImageTag: 'latest'
210+
containerImageTag: imageTag
198211
containerName: 'backend'
199212
ingressTargetPort: 8000
200213
maxReplicas: 1
@@ -218,7 +231,7 @@ param webSiteConfiguration webSiteConfigurationType = {
218231
location: solutionLocation
219232
containerImageRegistryDomain: 'biabcontainerreg.azurecr.io'
220233
containerImageName: 'macaefrontend'
221-
containerImageTag: 'latest'
234+
containerImageTag: imageTag
222235
containerName: 'backend'
223236
tags: tags
224237
environmentResourceId: null //Default value set on module configuration
@@ -731,10 +744,10 @@ var aiFoundryAiServicesResourceName = aiFoundryAiServicesConfiguration.?name ??
731744
var aiFoundryAIservicesEnabled = aiFoundryAiServicesConfiguration.?enabled ?? true
732745
var aiFoundryAiServicesModelDeployment = {
733746
format: 'OpenAI'
734-
name: 'gpt-4o'
735-
version: '2024-08-06'
747+
name: gptModelName
748+
version: gptModelVersion
736749
sku: {
737-
name: 'GlobalStandard'
750+
name: modelDeploymentType
738751
//Curently the capacity is set to 140 for opinanal performance.
739752
capacity: aiFoundryAiServicesConfiguration.?modelCapacity ?? 140
740753
}

infra/main.bicepparam

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
using './main.bicep'
22

3-
param solutionPrefix = null //Type a string value to customize the prefix for your resource names
3+
param solutionPrefix = readEnvironmentVariable('AZURE_ENV_NAME', 'macae')
44
param solutionLocation = readEnvironmentVariable('AZURE_LOCATION', 'swedencentral')
55
param azureOpenAILocation = readEnvironmentVariable('AZURE_ENV_OPENAI_LOCATION', 'swedencentral')
6+
param modelDeploymentType = readEnvironmentVariable('AZURE_ENV_MODEL_DEPLOYMENT_TYPE', 'GlobalStandard')
7+
param gptModelName = readEnvironmentVariable('AZURE_ENV_MODEL_NAME', 'gpt-4o')
8+
param gptModelVersion = readEnvironmentVariable('AZURE_ENV_MODEL_VERSION', '2024-08-06')
9+
param imageTag = readEnvironmentVariable('AZURE_ENV_IMAGETAG', 'latest')
10+
param enableTelemetry = bool(readEnvironmentVariable('AZURE_ENV_ENABLE_TELEMETRY', 'true'))
611
param logAnalyticsWorkspaceConfiguration = {
712
dataRetentionInDays: 30
813
existingWorkspaceResourceId: ''

infra/main.waf-aligned.bicepparam

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
using './main.bicep'
22

3-
param solutionPrefix = null //Type a string value to customize the prefix for your resource names
3+
param solutionPrefix = readEnvironmentVariable('AZURE_ENV_NAME', 'macae')
44
param solutionLocation = readEnvironmentVariable('AZURE_LOCATION', 'swedencentral')
55
param azureOpenAILocation = readEnvironmentVariable('AZURE_ENV_OPENAI_LOCATION', 'swedencentral')
6+
param modelDeploymentType = readEnvironmentVariable('AZURE_ENV_MODEL_DEPLOYMENT_TYPE', 'GlobalStandard')
7+
param gptModelName = readEnvironmentVariable('AZURE_ENV_MODEL_NAME', 'gpt-4o')
8+
param gptModelVersion = readEnvironmentVariable('AZURE_ENV_MODEL_VERSION', '2024-08-06')
9+
param imageTag = readEnvironmentVariable('AZURE_ENV_IMAGETAG', 'latest')
10+
param enableTelemetry = bool(readEnvironmentVariable('AZURE_ENV_ENABLE_TELEMETRY', 'true'))
611
param virtualMachineConfiguration = {
712
adminUsername: 'adminuser'
813
adminPassword: 'P@ssw0rd1234'

0 commit comments

Comments
 (0)