Skip to content

feat: Standardize Bicep Parameters for Code Modernization #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
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
34 changes: 19 additions & 15 deletions docs/CustomizingAzdParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,32 @@

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.


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

Change the Model Deployment Type (allowed values: Standard, GlobalStandard)
## Parameters

```shell
azd env set AZURE_ENV_MODEL_DEPLOYMENT_TYPE Standard
```
| Name | Type | Default Value | Purpose |
| -------------------------------------- | ------- | ---------------- | ---------------------------------------------------------------------------------------------------- |
| `AZURE_ENV_NAME` | string | `'azdtemp'` | Used as a prefix for all resource names to ensure uniqueness across environments. |
| `AZURE_LOCATION` | string | `'japaneast'` | Location of the Azure resources. Controls where the infrastructure will be deployed. |
| `AZURE_ENV_MODEL_DEPLOYMENT_TYPE` | string | `'GlobalStandard'` | Change the Model Deployment Type (allowed values: Standard, GlobalStandard). |
| `AZURE_ENV_MODEL_NAME` | string | `'gpt-4o'` | Set the Model Name (allowed values: gpt-4o). |
| `AZURE_ENV_MODEL_CAPACITY` | integer | `'200'` | Set the Model Capacity (choose a number based on available GPT model capacity in your subscription). |
| `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. |
| `AZURE_ENV_IMAGETAG` | string | `'latest'` | Set the Image tag Like (allowed values: latest, dev, hotfix) |

Set the Model Name (allowed values: gpt-4)
---

```shell
azd env set AZURE_ENV_MODEL_NAME gpt-4
```
## How to Set a Parameter

Change the Model Capacity (choose a number based on available GPT model capacity in your subscription)
To customize any of the above values, run the following command **before** `azd up`:

```shell
azd env set AZURE_ENV_MODEL_CAPACITY 30
```bash
azd env set <PARAMETER_NAME> <VALUE>
```

Set the Log Analytics Workspace Id if you need to reuse the existing workspace which is already existing
```shell
azd env set AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID '<Existing Log Analytics Workspace Id>'
**Example:**

```bash
azd env set AZURE_LOCATION westus2
```
7 changes: 4 additions & 3 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,23 @@ var safePrefix = length(Prefix) > 20 ? substring(Prefix, 0, 20) : Prefix
@description('Location for all Ai services resources. This location can be different from the resource group location.')
param AzureAiServiceLocation string // The location used for all deployed resources. This location must be in the same region as the resource group.
param capacity int = 5
param deploymentType string = 'GlobalStandard'
param llmModel string = 'gpt-4o'
param imageVersion string = 'latest'


param existingLogAnalyticsWorkspaceId string = ''

var uniqueId = toLower(uniqueString(subscription().id, safePrefix, resourceGroup().location))
var UniquePrefix = 'cm${padLeft(take(uniqueId, 12), 12, '0')}'
var ResourcePrefix = take('cm${safePrefix}${UniquePrefix}', 15)
var imageVersion = 'latest'
var location = resourceGroup().location
var dblocation = resourceGroup().location
var cosmosdbDatabase = 'cmsadb'
var cosmosdbBatchContainer = 'cmsabatch'
var cosmosdbFileContainer = 'cmsafile'
var cosmosdbLogContainer = 'cmsalog'
var deploymentType = 'GlobalStandard'
var containerName = 'appstorage'
var llmModel = 'gpt-4o'
var storageSkuName = 'Standard_LRS'
var storageContainerName = replace(replace(replace(replace('${ResourcePrefix}cast', '-', ''), '_', ''), '.', ''),'/', '')
var gptModelVersion = '2024-08-06'
Expand Down
6 changes: 5 additions & 1 deletion infra/main.bicepparam
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
using './main.bicep'

param AzureAiServiceLocation = readEnvironmentVariable('AZURE_LOCATION','japaneast')
param Prefix = readEnvironmentVariable('AZURE_ENV_NAME','azdtemp')
param AzureAiServiceLocation = readEnvironmentVariable('AZURE_LOCATION','japaneast')
param capacity = int(readEnvironmentVariable('AZURE_ENV_MODEL_CAPACITY', '200'))
param deploymentType = readEnvironmentVariable('AZURE_ENV_MODEL_DEPLOYMENT_TYPE', 'GlobalStandard')
param llmModel = readEnvironmentVariable('AZURE_ENV_MODEL_NAME', 'gpt-4o')
param imageVersion = readEnvironmentVariable('AZURE_ENV_IMAGETAG', 'latest')
param existingLogAnalyticsWorkspaceId = readEnvironmentVariable('AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID', '')