Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
78f93e9
Add submodule support in checkout step and set principalId in environ…
Harmanpreet-Microsoft Mar 30, 2026
58f1e44
Add timeout to template validation job and update principalId handling
Harmanpreet-Microsoft Mar 30, 2026
33dd3c2
Add TEMP environment variable and ensure timeout is set for template …
Harmanpreet-Microsoft Mar 30, 2026
08a473b
Configure bicepparam for service principal in template validation wor…
Harmanpreet-Microsoft Mar 30, 2026
480b376
Add submodule support in checkout step of Azure Dev workflow
Harmanpreet-Microsoft Apr 1, 2026
9211252
Add TEMP environment variable to Azure Dev workflow
Harmanpreet-Microsoft Apr 1, 2026
b2524f6
Add support for service principal in Azure Dev workflow
Harmanpreet-Microsoft Apr 1, 2026
4ba6f45
Merge pull request #3 from microsoft/main
Harmanpreet-Microsoft Apr 6, 2026
517abd6
feat: Configure Power BI API permissions for service principal in Azu…
Harmanpreet-Microsoft Apr 6, 2026
aaf5167
feat: Enhance infrastructure provisioning with retry mechanism and fr…
Harmanpreet-Microsoft Apr 6, 2026
ff47a00
feat: Add Power BI API access check before infrastructure provisioning
Harmanpreet-Microsoft Apr 6, 2026
beaaacf
refactor: Remove Power BI API permissions configuration and access ch…
Harmanpreet-Microsoft Apr 6, 2026
6574965
feat: Update AZD environment configuration to set principal type and …
Harmanpreet-Microsoft Apr 6, 2026
6297fe0
feat: Add resource group creation and environment setup in AZD workflow
Harmanpreet-Microsoft Apr 6, 2026
983e5ca
feat: Enhance resource group creation logic to derive name from envir…
Harmanpreet-Microsoft Apr 6, 2026
586e2bd
feat: Add re-authentication and retry logic for infrastructure provis…
Harmanpreet-Microsoft Apr 6, 2026
b365ea2
feat: Add resource group deletion check and retry logic during provis…
Harmanpreet-Microsoft Apr 6, 2026
1c1e6a5
feat: Update fabricWorkspaceMode to 'none' for consistent environment…
Harmanpreet-Microsoft Apr 6, 2026
5e2408e
feat: Remove re-authentication and retry logic from infrastructure pr…
Harmanpreet-Microsoft Apr 6, 2026
a04622d
feat: Remove timeout setting from infrastructure provisioning step
Harmanpreet-Microsoft Apr 6, 2026
605b81e
feat: Add quota check scripts for Azure OpenAI models and Fabric capa…
Rafi-Microsoft Apr 7, 2026
195cf60
feat: Refactor principal type and ID handling in workflow and paramet…
Harmanpreet-Microsoft Apr 8, 2026
529d37b
fix: Update VM credential instructions for clarity and consistency ac…
Rafi-Microsoft Apr 8, 2026
5d299d5
feat: Remove service principal ID retrieval and AZD environment confi…
Harmanpreet-Microsoft Apr 8, 2026
b2e390a
feat: Add AZURE_PRINCIPAL_ID and AZURE_PRINCIPAL_TYPE to environment …
Harmanpreet-Microsoft Apr 8, 2026
7e30209
added vm username param
Rafi-Microsoft Apr 8, 2026
80be276
added default password for vm
Rafi-Microsoft Apr 8, 2026
4559409
feat: Enhance Service Principal Object ID resolution logic in workflow
Harmanpreet-Microsoft Apr 8, 2026
cc157d2
feat: Remove Service Principal Object ID resolution step from workflow
Harmanpreet-Microsoft Apr 8, 2026
09ebdeb
Update Azure DevOps workflow for service principal handling
Harmanpreet-Microsoft Apr 8, 2026
5a09ec2
fix: add bicep version requirement (>= 0.33.0) to azure.yaml
Roopan-Microsoft Apr 9, 2026
ae8ee57
fix: add bicep version requirement (>= 0.33.0) to azure.yaml
Avijit-Microsoft Apr 9, 2026
d0985cd
Update workflow triggers for AZD template validation
Harmanpreet-Microsoft Apr 9, 2026
b6e4854
Merge pull request #126 from Harmanpreet-Microsoft/main
Roopan-Microsoft Apr 9, 2026
2047307
Merge pull request #128 from Rafi-Microsoft/psl-vmpasswordfix
Roopan-Microsoft Apr 9, 2026
ab864e0
Merge pull request #127 from Rafi-Microsoft/psl-addingfiles
Roopan-Microsoft Apr 9, 2026
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
12 changes: 11 additions & 1 deletion .github/workflows/azd-template-validation.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: AZD Template Validation
on:
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'infra/**'
- 'azure.yaml'
- 'scripts/**'
- '.github/workflows/azure-dev.yml'

permissions:
contents: read
Expand All @@ -16,6 +21,8 @@ jobs:
name: azd template validation
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

# This postprovision cleanup step (Stage 19) has been removed from azure.yaml because
# azd down was failing in the pipeline. As a workaround, we are removing this step
Expand All @@ -36,6 +43,9 @@ jobs:
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEMP: /tmp
fabricCapacityMode: 'none'
AZURE_PRINCIPAL_ID: ${{ vars.PRINCIPAL_ID || secrets.AZURE_CLIENT_ID }}
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Falling back to secrets.AZURE_CLIENT_ID for AZURE_PRINCIPAL_ID is likely incorrect: client/app ID is not the service principal object ID, and role assignments typically require the object ID. This can cause RBAC assignment failures during validation. Align this workflow with the object-ID resolution logic used in azure-dev.yml, or require an explicit PRINCIPAL_ID/AZURE_PRINCIPAL_ID value.

Suggested change
AZURE_PRINCIPAL_ID: ${{ vars.PRINCIPAL_ID || secrets.AZURE_CLIENT_ID }}
AZURE_PRINCIPAL_ID: ${{ vars.PRINCIPAL_ID || secrets.AZURE_PRINCIPAL_ID }}

Copilot uses AI. Check for mistakes.
AZURE_PRINCIPAL_TYPE: 'ServicePrincipal'
- name: print result
run: cat ${{ steps.validation.outputs.resultFile }}
53 changes: 50 additions & 3 deletions .github/workflows/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,73 @@ jobs:
AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }}
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
AZURE_USER_OBJECT_ID: ''
AZURE_PRINCIPAL_TYPE: 'ServicePrincipal'
TEMP: /tmp
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install azd
uses: Azure/setup-azd@v2

- name: Azure Developer CLI Login
run: |
azd auth login `
--client-id "$Env:AZURE_CLIENT_ID" `
--federated-credential-provider "github" `
--tenant-id "$Env:AZURE_TENANT_ID"
--tenant-id "$Env:AZURE_TENANT_ID"
shell: pwsh

- name: Azure CLI Login
uses: azure/login@v2
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}

- name: Resolve Service Principal Object ID
run: |
# If PRINCIPAL_ID repo variable is set and is a valid GUID, use it directly
if [[ "${{ vars.PRINCIPAL_ID }}" =~ ^[0-9a-fA-F-]{36}$ ]]; then
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GUID check regex is overly permissive (it allows any mix of hex and hyphens of length 36, even with hyphens in the wrong positions). Consider using a stricter pattern (8-4-4-4-12) to avoid accidentally accepting invalid IDs and then failing later during azd provision.

Suggested change
if [[ "${{ vars.PRINCIPAL_ID }}" =~ ^[0-9a-fA-F-]{36}$ ]]; then
if [[ "${{ vars.PRINCIPAL_ID }}" =~ ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$ ]]; then

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The practical risk is low since vars.PRINCIPAL_ID is set by repo admins, not user input, so a malformed GUID here is unlikely in practice

echo "Using PRINCIPAL_ID from repo variables"
echo "AZURE_PRINCIPAL_ID=${{ vars.PRINCIPAL_ID }}" >> $GITHUB_ENV
else
# Resolve the Object ID from the Application (Client) ID
# Role assignments require the SP Object ID, not the Client/App ID
echo "Resolving Service Principal Object ID from Client ID..."
SP_OBJECT_ID=$(az ad sp show --id "${{ vars.AZURE_CLIENT_ID }}" --query id -o tsv 2>/dev/null)
if [[ -z "$SP_OBJECT_ID" ]]; then
echo "::error::Failed to resolve Service Principal Object ID from Client ID: ${{ vars.AZURE_CLIENT_ID }}"
exit 1
fi
echo "Resolved SP Object ID: $SP_OBJECT_ID"
echo "AZURE_PRINCIPAL_ID=$SP_OBJECT_ID" >> $GITHUB_ENV
fi

- name: Create Resource Group if needed
run: |
# Use provided RG name or derive from environment name
RESOURCE_GROUP="${AZURE_RESOURCE_GROUP:-rg-${AZURE_ENV_NAME}}"
echo "Using resource group: $RESOURCE_GROUP"

RG_EXISTS=$(az group exists --name "$RESOURCE_GROUP")
if [ "$RG_EXISTS" = "false" ]; then
echo "Creating resource group: $RESOURCE_GROUP"
az group create --name "$RESOURCE_GROUP" --location ${{ vars.AZURE_LOCATION }}
else
echo "Resource group already exists: $RESOURCE_GROUP"
fi

# Set for subsequent steps
echo "RESOURCE_GROUP=$RESOURCE_GROUP" >> $GITHUB_ENV

- name: Provision Infrastructure
id: provision-main
run: azd provision --no-prompt
Comment on lines +72 to 91
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step computes/creates a resource group but exports it as RESOURCE_GROUP, while the job/environment uses AZURE_RESOURCE_GROUP. If AZURE_RESOURCE_GROUP is empty, azd provision likely won't pick up RESOURCE_GROUP and may provision into a different RG than the one you just created. Export the derived value back into AZURE_RESOURCE_GROUP (or whatever azd expects) so the provisioning step uses the same RG.

Copilot uses AI. Check for mistakes.
env:
AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }}
AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }}
AZURE_PRINCIPAL_TYPE: 'ServicePrincipal'
fabricCapacityMode: 'none'
fabricWorkspaceMode: 'none'
1 change: 1 addition & 0 deletions azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: deploy-your-ai-application-in-production

requiredVersions:
azd: ">=1.15.0 != 1.23.9"
bicep: '>= 0.33.0'

infra:
provider: "bicep"
Expand Down
12 changes: 9 additions & 3 deletions docs/ACCESSING_PRIVATE_RESOURCES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ azd env get-values | grep jumpVm

# Or in Azure Portal:
# 1. Navigate to your resource group
# 2. Find the VM (usually named like "vm-jump-<env>")
# 2. Find the VM resource created for the jump box
# 3. Click "Connect" → "Bastion"
# 4. Enter the username and password (auto-generated during deployment)
# 4. Enter the username and password you set via VM_ADMIN_USERNAME / VM_ADMIN_PASSWORD
```

### 2. From Jump VM, Access Private Services
Expand Down Expand Up @@ -169,7 +169,13 @@ You can configure services without private endpoints by modifying individual ser

### Jump VM credentials unknown

Credentials are auto-generated during deployment. To reset:
If you did not set the credentials before deployment, use the top-layer defaults or reset them:

- Username: `VM_ADMIN_USERNAME` environment variable, or `vmUserName` in [infra/main.bicepparam](../infra/main.bicepparam)
- Default username when unset: `testvmuser`
- Password: `VM_ADMIN_PASSWORD` environment variable, or `vmAdminPassword` in [infra/main.bicepparam](../infra/main.bicepparam)

To reset:

```bash
az vm user update \
Expand Down
2 changes: 1 addition & 1 deletion docs/deploy_app_from_foundry.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Since all resources are deployed with private endpoints, you must access Microso
2. Navigate to your resource group
3. Select the **Jump VM** (Windows Virtual Machine)
4. Click **Connect** → **Bastion**
5. Enter the VM credentials (set during deployment)
5. Enter the VM credentials you configured in the top layer (`VM_ADMIN_USERNAME` / `VM_ADMIN_PASSWORD`, or [infra/main.bicepparam](../infra/main.bicepparam))
6. Once connected, open a browser and navigate to [Microsoft Foundry](https://ai.azure.com)

### 2. Configure Your Playground
Expand Down
18 changes: 16 additions & 2 deletions docs/deploymentguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,22 @@ Edit `infra/main.bicepparam` or set environment variables:
| `postgreSqlNetworkIsolation` | PostgreSQL private networking toggle (defaults to `networkIsolation`) | `networkIsolation` |
| `useExistingVNet` | Reuse an existing VNet | `false` |
| `existingVnetResourceId` | Existing VNet resource ID (when `useExistingVNet=true`) | `` |
| `vmUserName` | Jump box VM admin username | `` |
| `vmAdminPassword` | Jump box VM admin password | (prompted) |
| `vmUserName` | Jump box VM admin username | `VM_ADMIN_USERNAME` env var or `testvmuser` |
| `vmAdminPassword` | Jump box VM admin password | `VM_ADMIN_PASSWORD` env var |

For network-isolated deployments, set the VM credentials before running `azd up`:

```powershell
azd env set VM_ADMIN_USERNAME "youradminuser"
azd env set VM_ADMIN_PASSWORD "Use-A-Strong-Password-Here!"
```

If you prefer source-controlled defaults, set them in [infra/main.bicepparam](../infra/main.bicepparam) instead:

```bicep
param vmUserName = 'youradminuser'
param vmAdminPassword = 'Use-A-Strong-Password-Here!'
Comment on lines +215 to +219
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guidance encourages committing VM admin credentials to source control. Please change the doc to recommend using azd env set (or a secrets manager / pipeline secret variables) and keep the Bicep snippet as a non-secret placeholder (e.g., show only vmUserName, and for password show a reference to readEnvironmentVariable / secretOrRandomPassword), explicitly warning not to commit passwords.

Suggested change
If you prefer source-controlled defaults, set them in [infra/main.bicepparam](../infra/main.bicepparam) instead:
```bicep
param vmUserName = 'youradminuser'
param vmAdminPassword = 'Use-A-Strong-Password-Here!'
Use `azd env set`, a secrets manager, or pipeline secret variables for the password. Do **not** commit VM passwords to source control.
If you need a non-secret placeholder in [infra/main.bicepparam](../infra/main.bicepparam), keep the username only and reference the password from the environment:
```bicep
param vmUserName = 'youradminuser'
param vmAdminPassword = readEnvironmentVariable('VM_ADMIN_PASSWORD', '')

Copilot uses AI. Check for mistakes.
```

</details>

Expand Down
7 changes: 4 additions & 3 deletions docs/post_deployment_steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,10 @@ For network-isolated deployments, use Azure Bastion to access resources:

![Image showing bastion blade](../img/provisioning/checkNetworkIsolation7.png)

4. Enter the VM admin credentials (set during deployment) and click **Connect**
- Admin username: `vmUserName` in [infra/main.bicep](../infra/main.bicep)
- Admin password: `vmAdminPassword` in [infra/main.bicepparam](../infra/main.bicepparam) (defaults to the `VM_ADMIN_PASSWORD` environment variable)
4. Enter the VM admin credentials and click **Connect**
- Admin username: `vmUserName` in [infra/main.bicepparam](../infra/main.bicepparam) or the `VM_ADMIN_USERNAME` environment variable
- Admin password: `vmAdminPassword` in [infra/main.bicepparam](../infra/main.bicepparam) or the `VM_ADMIN_PASSWORD` environment variable
- If `vmUserName` is not set in the top layer, the effective default is `testvmuser`
- If you do not have them, reset the password in **Azure Portal** → **Virtual machine** → **Reset password**.

![Image showing bastion login](../img/provisioning/checkNetworkIsolation8.png)
Expand Down
106 changes: 75 additions & 31 deletions docs/quota_check.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,97 @@
# Check Quota Availability Before Deployment

Before deploying the accelerator, **ensure sufficient quota availability** for the required model.
> **We recommend increasing the capacity to 100k tokens for optimal performance.**
Before deploying the accelerator, **ensure sufficient quota availability** for the required AI models and Fabric capacity.
> **The default capacities match the deployment parameters in `infra/main.bicepparam`.**

## Login if you have not done so already
```
az login
```

## 📌 Default Models & Capacities:
These match the `modelDeploymentList` in the Bicep parameters:
```
gpt-4o:150, gpt-4o-mini:150, gpt-4:150, text-embedding-3-small:100
gpt-4.1-mini:40:GlobalStandard, text-embedding-3-large:40:Standard
```

## 📌 Default Regions:
```
eastus, uksouth, eastus2, northcentralus, swedencentral, westus, westus2, southcentralus, canadacentral, australiaeast, japaneast, norwayeast
eastus, eastus2, swedencentral, uksouth, westus, westus2, southcentralus, canadacentral, australiaeast, japaneast, norwayeast
```

## 📌 Optional: Fabric Capacity Check
The accelerator also deploys a **Microsoft Fabric F8** capacity. Pass `--check-fabric` (bash) or `-CheckFabric` (PowerShell) to verify Fabric SKU availability.

## Usage Scenarios:
- No parameters passed → Default models and capacities will be checked in default regions.
- Only model(s) provided → The script will check for those models in the default regions.
- Only region(s) provided → The script will check default models in the specified regions.
- Both models and regions provided → The script will check those models in the specified regions.
- `--verbose` passed → Enables detailed logging output for debugging and traceability.
- `--check-fabric` passed → Also checks Microsoft Fabric capacity availability.

## **Input Formats**
> Use the --models, --regions, and --verbose options for parameter handling:
## **Input Formats — Bash**
> Use the --models, --regions, --verbose, and --check-fabric options for parameter handling:

✔️ Run without parameters to check default models & regions without verbose logging:
```
./quota_check.sh
✔️ Run without parameters to check default models & regions:
```sh
./quota_check.sh
```
✔️ Enable verbose logging:
```
./quota_check.sh --verbose
```sh
./quota_check.sh --verbose
```
✔️ Check specific model(s) in default regions:
```
./quota_check.sh --models gpt-4o:150,text-embedding-3-small:100
```sh
./quota_check.sh --models gpt-4.1-mini:40:GlobalStandard,text-embedding-3-large:40:Standard
```
✔️ Check default models in specific region(s):
```
./quota_check.sh --regions eastus,westus
```
✔️ Passing Both models and regions:
```
./quota_check.sh --models gpt-4o:150 --regions eastus,westus2
```sh
./quota_check.sh --regions eastus,westus
```
✔️ All parameters combined:
```sh
./quota_check.sh --models gpt-4.1-mini:40 --regions eastus,westus --verbose
```
✔️ Also check Fabric capacity availability:
```sh
./quota_check.sh --check-fabric --verbose
```
./quota_check.sh --models gpt-4:150,text-embedding-3-small:100 --regions eastus,westus --verbose

## **Input Formats — PowerShell**
> Use the -Models, -Regions, -Verbose, and -CheckFabric parameters:

✔️ Run without parameters:
```powershell
.\quota_check.ps1
```
✔️ Check specific model(s):
```powershell
.\quota_check.ps1 -Models "gpt-4.1-mini:40:GlobalStandard,text-embedding-3-large:40:Standard"
```
✔️ Multiple models with single region:
✔️ Check specific region(s):
```powershell
.\quota_check.ps1 -Regions "eastus,westus2"
```
./quota_check.sh --models gpt-4:150,text-embedding-3-small:100 --regions eastus2 --verbose
✔️ All parameters combined:
```powershell
.\quota_check.ps1 -Models "gpt-4.1-mini:40" -Regions "eastus,westus" -CheckFabric -Verbose
```

## **Sample Output**
The final table lists regions with available quota. You can select any of these regions for deployment.

![quota-check-output](../img/Documentation/quota-check-output.png)
```
╔══════════════════════════════════════════════════════════════╗
║ QUOTA CHECK SUMMARY ║
╚══════════════════════════════════════════════════════════════╝

Region gpt-4.1-mini text-embedding-3-large Status
──────────────────────────────────────────────────────────────────────────────────────────
eastus ✅ 200/240 (need 40) ✅ 120/200 (need 40) ✅ PASS
eastus2 ❌ 10/240 (need 40) ✅ 50/200 (need 40) ❌ FAIL
swedencentral ✅ 100/240 (need 40) ✅ 80/200 (need 40) ✅ PASS
```

---
## **If using Azure Portal and Cloud Shell**
Expand All @@ -74,22 +107,33 @@ The final table lists regions with available quota. You can select any of these
chmod +x quota_check.sh
./quota_check.sh
```
- Refer to [Input Formats](#input-formats) for detailed commands.
- Refer to [Input Formats — Bash](#input-formats--bash) for detailed commands.

## **If using VS Code or Codespaces**

### Option 1: Bash (Linux, macOS, Git Bash, WSL, Cloud Shell)
1. Open the terminal in VS Code or Codespaces.
2. Use a terminal that can run bash. This is only for the quota check script; deployment uses PowerShell.
2. Use a terminal that can run bash.
![git_bash](../img/provisioning/git_bash.png)
3. Navigate to the `scripts` folder where the script files are located and make the script as executable:
3. Navigate to the `scripts` folder and make the script executable:
```sh
cd scripts
chmod +x quota_check.sh
```
4. Run the appropriate script based on your requirement:

**To check quota for the deployment**

4. Run the script:
```sh
./quota_check.sh
```
- Refer to [Input Formats](#input-formats) for detailed commands.
- Refer to [Input Formats — Bash](#input-formats--bash) for detailed commands.

### Option 2: PowerShell (Windows, Linux, macOS)
1. Open a PowerShell terminal in VS Code.
2. Navigate to the `scripts` folder:
```powershell
cd scripts
```
3. Run the script:
```powershell
.\quota_check.ps1
```
- Refer to [Input Formats — PowerShell](#input-formats--powershell) for detailed commands.
5 changes: 3 additions & 2 deletions infra/main.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ param location = readEnvironmentVariable('AZURE_LOCATION', '')
param cosmosLocation = readEnvironmentVariable('AZURE_COSMOS_LOCATION', '')
// Entra object ID of the identity to grant RBAC (user, group, service principal, or UAI). Set this if Graph lookup is blocked.
param principalId = readEnvironmentVariable('AZURE_PRINCIPAL_ID', '')
param principalType = 'User'
param principalType = readEnvironmentVariable('AZURE_PRINCIPAL_TYPE', 'User')
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says AZURE_PRINCIPAL_TYPE defaults to 'ServicePrincipal', but the Bicep parameter defaults to 'User'. Please align the default behavior with the documented intent (either update the Bicep default, or adjust the PR description/docs if 'User' is the intended default).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defaults are intentionally different per context. The Bicep param defaults to 'User' for local azd up (where the deployer is a human), while the CI workflow explicitly sets AZURE_PRINCIPAL_TYPE:'ServicePrincipal' as an env var (lines 31 and 98 in azure-dev.yml).Since readEnvironmentVariable reads the env var first and only falls back to 'User' when unset, the correct value is always used in both paths. Happy to clarify the PR description to make this dual-default behavior more explicit.


// ========================================
// OPTIONAL INPUTS (Existing Resources)
Expand Down Expand Up @@ -204,7 +204,8 @@ param containerAppsList = [
}
]

param vmAdminPassword = readEnvironmentVariable('VM_ADMIN_PASSWORD', '$(secretOrRandomPassword)')
param vmUserName = readEnvironmentVariable('VM_ADMIN_USERNAME', 'testvmuser')
param vmAdminPassword = readEnvironmentVariable('VM_ADMIN_PASSWORD', 'JumpboxAdminP@ssw0rd1234!')
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding a default admin password (even as a fallback) is a severe security risk: it creates a known credential that may be deployed unintentionally. Prefer keeping the prior secret-or-random default (or requiring the value) and only overriding via VM_ADMIN_PASSWORD; if you want a deterministic dev default, keep it out of source control (e.g., set in a local .env/azd env) and document it as an example placeholder, not an actual default.

Suggested change
param vmAdminPassword = readEnvironmentVariable('VM_ADMIN_PASSWORD', 'JumpboxAdminP@ssw0rd1234!')
param vmAdminPassword = readEnvironmentVariable('VM_ADMIN_PASSWORD', '')

Copilot uses AI. Check for mistakes.
param vmSize = 'Standard_D2s_v4'

// ========================================
Expand Down
Loading
Loading