Skip to content

Commit b53fe9f

Browse files
fix: reduce default model capacity, add Bicep version guard, remove hardcoded VM credentials
- Reduce gptModelCapacity default from 150 to 30 TPM (addresses InsufficientQuota errors - 2.2% of failures) - Add bicep >= 0.33.0 to requiredVersions in azure.yaml and azure_custom.yaml (addresses InvalidTemplate errors - 43.2% of failures) - Remove hardcoded VM password fallback from main.bicep, main_custom.bicep, and main.json (OWASP A07:2021) - Add @minValue(1) constraint to gptModelCapacity parameter - Update docs to reflect new required VM credentials and reduced capacity default - Applied consistently across main.bicep, main_custom.bicep, main.json, and documentation
1 parent 4b70934 commit b53fe9f

7 files changed

Lines changed: 30 additions & 25 deletions

File tree

azure.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ metadata:
44

55
requiredVersions:
66
azd: '>= 1.18.0 != 1.23.9'
7+
bicep: '>= 0.33.0'
78

89
parameters:
910
AzureAiServiceLocation:

azure_custom.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ metadata:
44

55
requiredVersions:
66
azd: '>= 1.18.0 != 1.23.9'
7+
bicep: '>= 0.33.0'
78

89
parameters:
910
azureAiServiceLocation:

docs/CustomizingAzdParameters.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ By default this template will use the environment name as the prefix to prevent
1414
| `AZURE_ENV_MODEL_DEPLOYMENT_TYPE` | string | `GlobalStandard` | Change the Model Deployment Type (allowed values: Standard, GlobalStandard). |
1515
| `AZURE_ENV_MODEL_NAME` | string | `gpt-4o` | Set the Model Name (allowed values: gpt-4o). |
1616
| `AZURE_ENV_MODEL_VERSION` | string | `2024-08-06` | Set the Azure model version (allowed values: 2024-08-06) |
17-
| `AZURE_ENV_MODEL_CAPACITY` | integer | `150` | Set the Model Capacity (choose a number based on available GPT model capacity in your subscription). |
17+
| `AZURE_ENV_MODEL_CAPACITY` | integer | `30` | Set the Model Capacity (choose a number based on available GPT model capacity in your subscription). |
1818
| `AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID` | string | Guide to get your [Existing Workspace ID](/docs/re-use-log-analytics.md) | Set this if you want to reuse an existing Log Analytics Workspace instead of creating a new one. |
1919
| `AZURE_ENV_IMAGETAG` | string | `latest` | Set the Image tag Like (allowed values: latest, dev, hotfix) |
2020
| `AZURE_ENV_VM_SIZE` | string | `Standard_D2s_v5` | Specifies the size of the Jumpbox Virtual Machine (e.g., `Standard_D2s_v5`, `Standard_D2s_v4`). Set a custom value if `enablePrivateNetworking` is `true`. |
21-
| `AZURE_ENV_JUMPBOX_ADMIN_USERNAME` | string | `JumpboxAdminUser` | Specifies the administrator username for the Jumpbox Virtual Machine. |
22-
| `AZURE_ENV_JUMPBOX_ADMIN_PASSWORD` | string | `JumpboxAdminP@ssw0rd1234!` | Specifies the administrator password for the Jumpbox Virtual Machine. |
21+
| `AZURE_ENV_JUMPBOX_ADMIN_USERNAME` | string | *(required when enablePrivateNetworking is true)* | Specifies the administrator username for the Jumpbox Virtual Machine. Must be provided — no default for security. |
22+
| `AZURE_ENV_JUMPBOX_ADMIN_PASSWORD` | string | *(required when enablePrivateNetworking is true)* | Specifies the administrator password for the Jumpbox Virtual Machine. Must meet Azure complexity requirements. |
2323
| `AZURE_ENV_COSMOS_SECONDARY_LOCATION` | string | *(not set by default)* | Specifies the secondary region for Cosmos DB. Required if `enableRedundancy` is `true`. |
2424
| `AZURE_EXISTING_AI_PROJECT_RESOURCE_ID` | string | *(not set by default)* | Specifies the existing AI Foundry Project Resource ID if it needs to be reused. |
2525
| `AZURE_ENV_ACR_NAME` | string | `cmsacontainerreg.azurecr.io` | Specifies the Azure Container Registry name to use for container images. |

docs/DeploymentGuide.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,19 @@ Copy the contents from the production configuration file to your main parameters
198198
5. Select all existing content (Ctrl+A) and paste the copied content (Ctrl+V)
199199
6. Save the file (Ctrl+S)
200200

201-
### 3.2 Set VM Credentials (Optional - Production Deployment Only)
201+
### 3.2 Set VM Credentials (Required for Production Deployment)
202202

203203
> **Note:** This section only applies if you selected **Production** deployment type in section 3.1. VMs are not deployed in the default Development/Testing configuration.
204204

205-
By default, hard-coded fallback values are used for VM credentials (`JumpboxAdminUser` / `JumpboxAdminP@ssw0rd1234!`). To set custom credentials:
205+
VM credentials must be explicitly provided when deploying with private networking enabled. No default credentials are used for security reasons.
206206

207207
```shell
208208
azd env set AZURE_ENV_JUMPBOX_ADMIN_USERNAME <your-username>
209209
azd env set AZURE_ENV_JUMPBOX_ADMIN_PASSWORD <your-password>
210210
```
211211

212+
> **Password requirements:** 12+ characters, at least one uppercase, one lowercase, one number, and one special character.
213+
212214
### 3.3 Advanced Configuration (Optional)
213215

214216
<details>

infra/main.bicep

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ var replicaRegionPairs = {
5656
}
5757
var replicaLocation = replicaRegionPairs[resourceGroup().location]
5858

59-
@description('Optional. AI model deployment token capacity. Defaults to 150K tokens per minute.')
60-
param gptModelCapacity int = 150
59+
@description('Optional. AI model deployment token capacity (thousands of tokens per minute). Must not exceed your subscription GlobalStandard quota. Reduce if provisioning fails with InsufficientQuota.')
60+
@minValue(1)
61+
param gptModelCapacity int = 30
6162

6263
@description('Optional. Enable monitoring for the resources. This will enable Application Insights and Log Analytics. Defaults to false.')
6364
param enableMonitoring bool = false
@@ -77,14 +78,12 @@ param enablePrivateNetworking bool = false
7778
@description('Optional. Size of the Jumpbox Virtual Machine when created. Set to custom value if enablePrivateNetworking is true.')
7879
param vmSize string?
7980

80-
@description('Optional. Admin username for the Jumpbox Virtual Machine. Set to custom value if enablePrivateNetworking is true.')
81+
@description('Required when enablePrivateNetworking is true. Admin username for the Jumpbox VM. Must be provided — no default for security.')
8182
@secure()
82-
//param vmAdminUsername string = take(newGuid(), 20)
8383
param vmAdminUsername string?
8484

85-
@description('Optional. Admin password for the Jumpbox Virtual Machine. Set to custom value if enablePrivateNetworking is true.')
85+
@description('Required when enablePrivateNetworking is true. Admin password for the Jumpbox VM. Must meet Azure complexity requirements (12+ chars, uppercase, lowercase, number, special char). Must be provided — no default for security.')
8686
@secure()
87-
//param vmAdminPassword string = newGuid()
8887
param vmAdminPassword string?
8988

9089
@description('Optional. Specifies the resource tags for all the resources. Tag "azd-env-name" is automatically added to all resources.')
@@ -637,8 +636,8 @@ module virtualMachine 'br/public:avm/res/compute/virtual-machine:0.20.0' = if (e
637636
computerName: take(virtualMachineResourceName, 15)
638637
osType: 'Windows'
639638
vmSize: !empty(vmSize) ? vmSize : 'Standard_D2s_v5'
640-
adminUsername: !empty(vmAdminUsername) ? vmAdminUsername : 'JumpboxAdminUser'
641-
adminPassword: !empty(vmAdminPassword) ? vmAdminPassword : 'JumpboxAdminP@ssw0rd1234!'
639+
adminUsername: vmAdminUsername!
640+
adminPassword: vmAdminPassword!
642641
managedIdentities: {
643642
systemAssigned: true
644643
}

infra/main.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@
6666
},
6767
"gptModelCapacity": {
6868
"type": "int",
69-
"defaultValue": 150,
69+
"defaultValue": 30,
70+
"minValue": 1,
7071
"metadata": {
71-
"description": "Optional. AI model deployment token capacity. Defaults to 150K tokens per minute."
72+
"description": "Optional. AI model deployment token capacity (thousands of tokens per minute). Must not exceed your subscription GlobalStandard quota. Reduce if provisioning fails with InsufficientQuota."
7273
}
7374
},
7475
"enableMonitoring": {
@@ -117,14 +118,14 @@
117118
"type": "securestring",
118119
"nullable": true,
119120
"metadata": {
120-
"description": "Optional. Admin username for the Jumpbox Virtual Machine. Set to custom value if enablePrivateNetworking is true."
121+
"description": "Required when enablePrivateNetworking is true. Admin username for the Jumpbox VM. Must be provided — no default for security."
121122
}
122123
},
123124
"vmAdminPassword": {
124125
"type": "securestring",
125126
"nullable": true,
126127
"metadata": {
127-
"description": "Optional. Admin password for the Jumpbox Virtual Machine. Set to custom value if enablePrivateNetworking is true."
128+
"description": "Required when enablePrivateNetworking is true. Admin password for the Jumpbox VM. Must meet Azure complexity requirements (12+ chars, uppercase, lowercase, number, special char). Must be provided — no default for security."
128129
}
129130
},
130131
"tags": {
@@ -16618,8 +16619,8 @@
1661816619
"value": "Windows"
1661916620
},
1662016621
"vmSize": "[if(not(empty(parameters('vmSize'))), createObject('value', parameters('vmSize')), createObject('value', 'Standard_D2s_v5'))]",
16621-
"adminUsername": "[if(not(empty(parameters('vmAdminUsername'))), createObject('value', parameters('vmAdminUsername')), createObject('value', 'JumpboxAdminUser'))]",
16622-
"adminPassword": "[if(not(empty(parameters('vmAdminPassword'))), createObject('value', parameters('vmAdminPassword')), createObject('value', 'JumpboxAdminP@ssw0rd1234!'))]",
16622+
"adminUsername": "[createObject('value', parameters('vmAdminUsername'))]",
16623+
"adminPassword": "[createObject('value', parameters('vmAdminPassword'))]",
1662316624
"managedIdentities": {
1662416625
"value": {
1662516626
"systemAssigned": true

infra/main_custom.bicep

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ var replicaRegionPairs = {
5656
}
5757
var replicaLocation = replicaRegionPairs[resourceGroup().location]
5858

59-
@description('Optional. AI model deployment token capacity. Defaults to 150K tokens per minute.')
60-
param gptModelCapacity int = 150
59+
@description('Optional. AI model deployment token capacity (thousands of tokens per minute). Must not exceed your subscription GlobalStandard quota. Reduce if provisioning fails with InsufficientQuota.')
60+
@minValue(1)
61+
param gptModelCapacity int = 30
6162

6263
@description('Optional. Enable monitoring for the resources. This will enable Application Insights and Log Analytics. Defaults to false.')
6364
param enableMonitoring bool = false
@@ -77,12 +78,12 @@ param enablePrivateNetworking bool = false
7778
@description('Optional. Size of the Jumpbox Virtual Machine when created. Set to custom value if enablePrivateNetworking is true.')
7879
param vmSize string?
7980

80-
@description('Optional. Admin username for the Jumpbox Virtual Machine. Set to custom value if enablePrivateNetworking is true.')
81+
@description('Required when enablePrivateNetworking is true. Admin username for the Jumpbox VM. Must be provided — no default for security.')
8182
@secure()
8283
//param vmAdminUsername string = take(newGuid(), 20)
8384
param vmAdminUsername string?
8485

85-
@description('Optional. Admin password for the Jumpbox Virtual Machine. Set to custom value if enablePrivateNetworking is true.')
86+
@description('Required when enablePrivateNetworking is true. Admin password for the Jumpbox VM. Must meet Azure complexity requirements (12+ chars, uppercase, lowercase, number, special char). Must be provided — no default for security.')
8687
@secure()
8788
//param vmAdminPassword string = newGuid()
8889
param vmAdminPassword string?
@@ -566,8 +567,8 @@ module virtualMachine 'br/public:avm/res/compute/virtual-machine:0.20.0' = if (e
566567
computerName: take(virtualMachineResourceName, 15)
567568
osType: 'Windows'
568569
vmSize: !empty(vmSize) ? vmSize : 'Standard_D2s_v5'
569-
adminUsername: !empty(vmAdminUsername) ? vmAdminUsername : 'JumpboxAdminUser'
570-
adminPassword: !empty(vmAdminPassword) ? vmAdminPassword : 'JumpboxAdminP@ssw0rd1234!'
570+
adminUsername: vmAdminUsername!
571+
adminPassword: vmAdminPassword!
571572
managedIdentities: {
572573
systemAssigned: true
573574
}

0 commit comments

Comments
 (0)