Skip to content

Commit 0ff6ab4

Browse files
Merge pull request #117 from microsoft/psl-us18810-codmod
feat: Standardize Bicep Parameters for Code Modernization
2 parents cc64239 + e1d534e commit 0ff6ab4

3 files changed

Lines changed: 47 additions & 22 deletions

File tree

docs/CustomizingAzdParameters.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,33 @@
22

33
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.
44

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.
56
6-
> To override any of the parameters, run `azd env set <key> <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.
7+
## Parameters
78

8-
Change the Content Understanding Location (allowed values: Sweden Central, Australia East)
9+
| Name | Type | Default Value | Purpose |
10+
| -------------------------------------- | ------- | ---------------- | ---------------------------------------------------------------------------------------------------- |
11+
| `AZURE_ENV_NAME` | string | `azdtemp` | Used as a prefix for all resource names to ensure uniqueness across environments. |
12+
| `AZURE_LOCATION` | string | `japaneast` | Location of the Azure resources. Controls where the infrastructure will be deployed. |
13+
| `AZURE_ENV_MODEL_DEPLOYMENT_TYPE` | string | `GlobalStandard` | Change the Model Deployment Type (allowed values: Standard, GlobalStandard). |
14+
| `AZURE_ENV_MODEL_NAME` | string | `gpt-4o` | Set the Model Name (allowed values: gpt-4o). |
15+
| `AZURE_ENV_MODEL_VERSION` | string | `2024-08-06` | Set the Azure model version (allowed values: 2024-08-06) |
16+
| `AZURE_ENV_MODEL_CAPACITY` | integer | `200` | Set the Model Capacity (choose a number based on available GPT model capacity in your subscription). |
17+
| `AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID` | string | `<Existing Workspace Id>` | Set this if you want to reuse an existing Log Analytics Workspace instead of creating a new one. |
18+
| `AZURE_ENV_IMAGETAG` | string | `latest` | Set the Image tag Like (allowed values: latest, dev, hotfix) |
919

10-
```shell
11-
azd env set AZURE_ENV_CU_LOCATION 'swedencentral'
12-
```
13-
14-
Change the Model Deployment Type (allowed values: Standard, GlobalStandard)
20+
---
1521

16-
```shell
17-
azd env set AZURE_ENV_MODEL_DEPLOYMENT_TYPE Standard
18-
```
22+
## How to Set a Parameter
1923

20-
Set the Model Name (allowed values: gpt-4o)
24+
To customize any of the above values, run the following command **before** `azd up`:
2125

22-
```shell
23-
azd env set AZURE_ENV_MODEL_NAME gpt-4o
26+
```bash
27+
azd env set <PARAMETER_NAME> <VALUE>
2428
```
2529

26-
Change the Model Capacity (choose a number based on available GPT model capacity in your subscription)
30+
**Example:**
2731

28-
```shell
29-
azd env set AZURE_ENV_MODEL_CAPACITY 30
32+
```bash
33+
azd env set AZURE_LOCATION westus2
3034
```
31-

infra/main.bicep

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,41 @@ var safePrefix = length(Prefix) > 20 ? substring(Prefix, 0, 20) : Prefix
3131
])
3232
@description('Location for all Ai services resources. This location can be different from the resource group location.')
3333
param AzureAiServiceLocation string // The location used for all deployed resources. This location must be in the same region as the resource group.
34+
35+
@minValue(5)
36+
@description('Capacity of the GPT deployment:')
3437
param capacity int = 5
3538

39+
@minLength(1)
40+
@description('GPT model deployment type:')
41+
param deploymentType string = 'GlobalStandard'
42+
43+
@minLength(1)
44+
@description('Name of the GPT model to deploy:')
45+
param llmModel string = 'gpt-4o'
46+
47+
@minLength(1)
48+
@description('Set the Image tag:')
49+
param imageVersion string = 'latest'
50+
51+
@minLength(1)
52+
@description('Version of the GPT model to deploy:')
53+
param gptModelVersion string = '2024-08-06'
54+
55+
56+
3657
var uniqueId = toLower(uniqueString(subscription().id, safePrefix, resourceGroup().location))
3758
var UniquePrefix = 'cm${padLeft(take(uniqueId, 12), 12, '0')}'
3859
var ResourcePrefix = take('cm${safePrefix}${UniquePrefix}', 15)
39-
var imageVersion = 'latest'
4060
var location = resourceGroup().location
4161
var dblocation = resourceGroup().location
4262
var cosmosdbDatabase = 'cmsadb'
4363
var cosmosdbBatchContainer = 'cmsabatch'
4464
var cosmosdbFileContainer = 'cmsafile'
4565
var cosmosdbLogContainer = 'cmsalog'
46-
var deploymentType = 'GlobalStandard'
4766
var containerName = 'appstorage'
48-
var llmModel = 'gpt-4o'
4967
var storageSkuName = 'Standard_LRS'
5068
var storageContainerName = replace(replace(replace(replace('${ResourcePrefix}cast', '-', ''), '_', ''), '.', ''),'/', '')
51-
var gptModelVersion = '2024-08-06'
5269
var azureAiServicesName = '${abbrs.ai.aiServices}${ResourcePrefix}'
5370

5471

infra/main.bicepparam

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

3-
param AzureAiServiceLocation = readEnvironmentVariable('AZURE_LOCATION','japaneast')
43
param Prefix = readEnvironmentVariable('AZURE_ENV_NAME','azdtemp')
4+
param AzureAiServiceLocation = readEnvironmentVariable('AZURE_LOCATION','japaneast')
5+
param capacity = int(readEnvironmentVariable('AZURE_ENV_MODEL_CAPACITY', '200'))
6+
param deploymentType = readEnvironmentVariable('AZURE_ENV_MODEL_DEPLOYMENT_TYPE', 'GlobalStandard')
7+
param llmModel = readEnvironmentVariable('AZURE_ENV_MODEL_NAME', 'gpt-4o')
8+
param gptModelVersion = readEnvironmentVariable('AZURE_ENV_MODEL_VERSION', '2024-08-06')
9+
param imageVersion = readEnvironmentVariable('AZURE_ENV_IMAGETAG', 'latest')

0 commit comments

Comments
 (0)