From f61234f2470b4ae402afcaa08bfb4ea8e5c7a7c1 Mon Sep 17 00:00:00 2001 From: "Vishal Shinde (Persistent Systems Inc)" Date: Tue, 10 Jun 2025 17:13:45 +0530 Subject: [PATCH 1/2] US:18890-Standardize Bicep Parameters for MACAE --- docs/CustomizingAzdParameters.md | 29 +++++++++++++++++++++++++++++ documentation/DeploymentGuide.md | 18 +++++++++--------- infra/main.bicepparam | 3 ++- infra/main.waf-aligned.bicepparam | 3 ++- 4 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 docs/CustomizingAzdParameters.md diff --git a/docs/CustomizingAzdParameters.md b/docs/CustomizingAzdParameters.md new file mode 100644 index 000000000..0d4bbb0be --- /dev/null +++ b/docs/CustomizingAzdParameters.md @@ -0,0 +1,29 @@ +## [Optional]: Customizing resource names + +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 ` 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. + +## Parameters +| Name | Type | Default Value | Purpose | +| ---------------------------- | ------ | ----------------- | --------------------------------------------------------------------------------------------------- | +| `AZURE_ENV_NAME` | string | `macae` | 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_OPENAI_LOCATION` | string | `swedencentral` | Specifies the region for OpenAI resource deployment. | +| `AZURE_ENV_ENABLE_TELEMETRY` | bool | `true` | Enables telemetry for monitoring and diagnostics. | + +--- + +## How to Set a Parameter + +To customize any of the above values, run the following command **before** `azd up`: + +```bash +azd env set +``` + +**Example:** + +```bash +azd env set AZURE_LOCATION westus2 +``` diff --git a/documentation/DeploymentGuide.md b/documentation/DeploymentGuide.md index 420bfe90d..5d100ed00 100644 --- a/documentation/DeploymentGuide.md +++ b/documentation/DeploymentGuide.md @@ -134,15 +134,15 @@ Consider the following settings during your deployment to modify specific settin
Configurable Deployment Settings -When you start the deployment, most parameters will have **default values**, but you can update the following settings: - -| **Setting** | **Description** | **Default value** | -| --------------------------------- | ------------------------------------------------------------------------------------------- | ----------------- | -| **Azure Region** | The region where resources will be created. | East US | -| **Secondary Location** | A **less busy** region for **Azure Cosmos DB**, useful in case of availability constraints. | eastus2 | -| **Deployment Type** | Select from a drop-down list. | GlobalStandard | -| **GPT Model** | Choose from **gpt-4, gpt-4o, gpt-4o-mini**. | gpt-4o | -| **GPT Model Deployment Capacity** | Configure capacity for **GPT models**. | 140k | +When you start the deployment, most parameters will have **default values**, but you can update the following settings [here](../docs/CustomizingAzdParameters.md): + +| **Setting** | **Description** | **Default value** | +| ------------------------------ | ------------------------------------------------------------------------------------ | ----------------- | +| **Environment Name** | Used as a prefix for all resource names to ensure uniqueness across environments. | macae | +| **Azure Region** | Location of the Azure resources. Controls where the infrastructure will be deployed. | japaneast | +| **OpenAI Deployment Location** | Specifies the region for OpenAI resource deployment. | swedencentral | +| **Enable Telemetry** | Enables telemetry for monitoring and diagnostics. | true | +
diff --git a/infra/main.bicepparam b/infra/main.bicepparam index 69723341e..7a2203e85 100644 --- a/infra/main.bicepparam +++ b/infra/main.bicepparam @@ -1,8 +1,9 @@ using './main.bicep' -param solutionPrefix = null //Type a string value to customize the prefix for your resource names +param solutionPrefix = readEnvironmentVariable('AZURE_ENV_NAME', 'macae') param solutionLocation = readEnvironmentVariable('AZURE_LOCATION', 'swedencentral') param azureOpenAILocation = readEnvironmentVariable('AZURE_ENV_OPENAI_LOCATION', 'swedencentral') +param enableTelemetry = bool(readEnvironmentVariable('AZURE_ENV_ENABLE_TELEMETRY', 'true')) param logAnalyticsWorkspaceConfiguration = { dataRetentionInDays: 30 existingWorkspaceResourceId: '' diff --git a/infra/main.waf-aligned.bicepparam b/infra/main.waf-aligned.bicepparam index 0a226da80..d913c227c 100644 --- a/infra/main.waf-aligned.bicepparam +++ b/infra/main.waf-aligned.bicepparam @@ -1,8 +1,9 @@ using './main.bicep' -param solutionPrefix = null //Type a string value to customize the prefix for your resource names +param solutionPrefix = readEnvironmentVariable('AZURE_ENV_NAME', 'macae') param solutionLocation = readEnvironmentVariable('AZURE_LOCATION', 'swedencentral') param azureOpenAILocation = readEnvironmentVariable('AZURE_ENV_OPENAI_LOCATION', 'swedencentral') +param enableTelemetry = bool(readEnvironmentVariable('AZURE_ENV_ENABLE_TELEMETRY', 'true')) param virtualMachineConfiguration = { adminUsername: 'adminuser' adminPassword: 'P@ssw0rd1234' From 4782a3e044fcd37d0ee36594370863a892d5fcb2 Mon Sep 17 00:00:00 2001 From: "Vishal Shinde (Persistent Systems Inc)" Date: Thu, 12 Jun 2025 14:01:15 +0530 Subject: [PATCH 2/2] added more paramter in bicep file and md file --- docs/CustomizingAzdParameters.md | 17 +++++++++++------ docs/DeploymentGuide.md | 6 +++++- infra/main.bicep | 23 ++++++++++++++++++----- infra/main.bicepparam | 4 ++++ infra/main.waf-aligned.bicepparam | 4 ++++ 5 files changed, 42 insertions(+), 12 deletions(-) diff --git a/docs/CustomizingAzdParameters.md b/docs/CustomizingAzdParameters.md index 0d4bbb0be..b4e194726 100644 --- a/docs/CustomizingAzdParameters.md +++ b/docs/CustomizingAzdParameters.md @@ -5,12 +5,17 @@ By default this template will use the environment name as the prefix to prevent > To override any of the parameters, run `azd env set ` 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. ## Parameters -| Name | Type | Default Value | Purpose | -| ---------------------------- | ------ | ----------------- | --------------------------------------------------------------------------------------------------- | -| `AZURE_ENV_NAME` | string | `macae` | 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_OPENAI_LOCATION` | string | `swedencentral` | Specifies the region for OpenAI resource deployment. | -| `AZURE_ENV_ENABLE_TELEMETRY` | bool | `true` | Enables telemetry for monitoring and diagnostics. | + +| Name | Type | Default Value | Purpose | +| ------------------------------- | ------ | ----------------- | --------------------------------------------------------------------------------------------------- | +| `AZURE_ENV_NAME` | string | `macae` | Used as a prefix for all resource names to ensure uniqueness across environments. | +| `AZURE_LOCATION` | string | `swedencentral` | Location of the Azure resources. Controls where the infrastructure will be deployed. | +| `AZURE_ENV_OPENAI_LOCATION` | string | `swedencentral` | Specifies the region for OpenAI resource deployment. | +| `AZURE_ENV_MODEL_DEPLOYMENT_TYPE` | string | `GlobalStandard` | Defines the deployment type for the AI model (e.g., Standard, GlobalStandard). | +| `AZURE_ENV_MODEL_NAME` | string | `gpt-4o` | Specifies the name of the GPT model to be deployed. | +| `AZURE_ENV_MODEL_VERSION` | string | `2024-08-06` | Version of the GPT model to be used for deployment. | +| `AZURE_ENV_IMAGETAG` | string | `latest` | Docker image tag used for container deployments. | +| `AZURE_ENV_ENABLE_TELEMETRY` | bool | `true` | Enables telemetry for monitoring and diagnostics. | --- diff --git a/docs/DeploymentGuide.md b/docs/DeploymentGuide.md index d89f8e85b..c45603940 100644 --- a/docs/DeploymentGuide.md +++ b/docs/DeploymentGuide.md @@ -139,8 +139,12 @@ When you start the deployment, most parameters will have **default values**, but | **Setting** | **Description** | **Default value** | | ------------------------------ | ------------------------------------------------------------------------------------ | ----------------- | | **Environment Name** | Used as a prefix for all resource names to ensure uniqueness across environments. | macae | -| **Azure Region** | Location of the Azure resources. Controls where the infrastructure will be deployed. | japaneast | +| **Azure Region** | Location of the Azure resources. Controls where the infrastructure will be deployed. | swedencentral | | **OpenAI Deployment Location** | Specifies the region for OpenAI resource deployment. | swedencentral | +| **Model Deployment Type** | Defines the deployment type for the AI model (e.g., Standard, GlobalStandard). | GlobalStandard | +| **GPT Model Name** | Specifies the name of the GPT model to be deployed. | gpt-4o | +| **GPT Model Version** | Version of the GPT model to be used for deployment. | 2024-08-06 | +| **Image Tag** | Docker image tag used for container deployments. | latest | | **Enable Telemetry** | Enables telemetry for monitoring and diagnostics. | true | diff --git a/infra/main.bicep b/infra/main.bicep index 9991ad766..b0552b5cc 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -16,6 +16,19 @@ param enableTelemetry bool = true @description('Azure OpenAI Location') param azureOpenAILocation string +@minLength(1) +@description('Name of the GPT model to deploy:') +param gptModelName string = 'gpt-4o' + +param gptModelVersion string = '2024-08-06' + +@minLength(1) +@description('GPT model deployment type:') +param modelDeploymentType string = 'GlobalStandard' + +@description('Set the image tag for the container images used in the solution. Default is "latest".') +param imageTag string = 'latest' + // @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.') // param AZURE_LOCATION string='' // param solutionLocation string = empty(AZURE_LOCATION) ? resourceGroup().location @@ -194,7 +207,7 @@ param containerAppConfiguration containerAppConfigurationType = { containerMemory: '4.0Gi' containerImageRegistryDomain: 'biabcontainerreg.azurecr.io' containerImageName: 'macaebackend' - containerImageTag: 'latest' + containerImageTag: imageTag containerName: 'backend' ingressTargetPort: 8000 maxReplicas: 1 @@ -218,7 +231,7 @@ param webSiteConfiguration webSiteConfigurationType = { location: solutionLocation containerImageRegistryDomain: 'biabcontainerreg.azurecr.io' containerImageName: 'macaefrontend' - containerImageTag: 'latest' + containerImageTag: imageTag containerName: 'backend' tags: tags environmentResourceId: null //Default value set on module configuration @@ -731,10 +744,10 @@ var aiFoundryAiServicesResourceName = aiFoundryAiServicesConfiguration.?name ?? var aiFoundryAIservicesEnabled = aiFoundryAiServicesConfiguration.?enabled ?? true var aiFoundryAiServicesModelDeployment = { format: 'OpenAI' - name: 'gpt-4o' - version: '2024-08-06' + name: gptModelName + version: gptModelVersion sku: { - name: 'GlobalStandard' + name: modelDeploymentType //Curently the capacity is set to 140 for opinanal performance. capacity: aiFoundryAiServicesConfiguration.?modelCapacity ?? 140 } diff --git a/infra/main.bicepparam b/infra/main.bicepparam index 7a2203e85..5f32de008 100644 --- a/infra/main.bicepparam +++ b/infra/main.bicepparam @@ -3,6 +3,10 @@ using './main.bicep' param solutionPrefix = readEnvironmentVariable('AZURE_ENV_NAME', 'macae') param solutionLocation = readEnvironmentVariable('AZURE_LOCATION', 'swedencentral') param azureOpenAILocation = readEnvironmentVariable('AZURE_ENV_OPENAI_LOCATION', 'swedencentral') +param modelDeploymentType = readEnvironmentVariable('AZURE_ENV_MODEL_DEPLOYMENT_TYPE', 'GlobalStandard') +param gptModelName = readEnvironmentVariable('AZURE_ENV_MODEL_NAME', 'gpt-4o') +param gptModelVersion = readEnvironmentVariable('AZURE_ENV_MODEL_VERSION', '2024-08-06') +param imageTag = readEnvironmentVariable('AZURE_ENV_IMAGETAG', 'latest') param enableTelemetry = bool(readEnvironmentVariable('AZURE_ENV_ENABLE_TELEMETRY', 'true')) param logAnalyticsWorkspaceConfiguration = { dataRetentionInDays: 30 diff --git a/infra/main.waf-aligned.bicepparam b/infra/main.waf-aligned.bicepparam index d913c227c..ac45cdcf3 100644 --- a/infra/main.waf-aligned.bicepparam +++ b/infra/main.waf-aligned.bicepparam @@ -3,6 +3,10 @@ using './main.bicep' param solutionPrefix = readEnvironmentVariable('AZURE_ENV_NAME', 'macae') param solutionLocation = readEnvironmentVariable('AZURE_LOCATION', 'swedencentral') param azureOpenAILocation = readEnvironmentVariable('AZURE_ENV_OPENAI_LOCATION', 'swedencentral') +param modelDeploymentType = readEnvironmentVariable('AZURE_ENV_MODEL_DEPLOYMENT_TYPE', 'GlobalStandard') +param gptModelName = readEnvironmentVariable('AZURE_ENV_MODEL_NAME', 'gpt-4o') +param gptModelVersion = readEnvironmentVariable('AZURE_ENV_MODEL_VERSION', '2024-08-06') +param imageTag = readEnvironmentVariable('AZURE_ENV_IMAGETAG', 'latest') param enableTelemetry = bool(readEnvironmentVariable('AZURE_ENV_ENABLE_TELEMETRY', 'true')) param virtualMachineConfiguration = { adminUsername: 'adminuser'