Skip to content

Commit 73dc98a

Browse files
updated bicep
1 parent b9d4cc0 commit 73dc98a

7 files changed

Lines changed: 35 additions & 47 deletions

File tree

code/scripts/package_frontend.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ cp backend dist -r -Force
99

1010
# Node
1111
cd frontend
12-
npm ci
12+
npm install
1313
npm run build

code/scripts/package_frontend.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ cp *.py dist
99
cp -r backend dist
1010

1111
cd frontend
12-
npm ci
12+
npm install
1313
npm run build

docker/Frontend.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
33
WORKDIR /home/node/app
44
COPY ./code/frontend/package*.json ./
55
USER node
6+
# RUN npm install --force
67
RUN npm ci
78
COPY --chown=node:node ./code/frontend ./frontend
89
WORKDIR /home/node/app/frontend
10+
RUN npm install --save-dev @types/node @types/jest
911
RUN npm run build
1012

1113
FROM python:3.11.7-bookworm

infra/main.bicep

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,6 @@ module openai 'modules/core/ai/cognitiveservices.bicep' = {
989989
: []
990990
)
991991
}
992-
// Implicit dependency on the specific DNS zone is established via the privateDnsZoneResourceId param reference
993992
}
994993

995994
module computerVision 'modules/core/ai/cognitiveservices.bicep' = if (useAdvancedImageProcessing) {
@@ -1030,7 +1029,6 @@ module computerVision 'modules/core/ai/cognitiveservices.bicep' = if (useAdvance
10301029
: []
10311030
)
10321031
}
1033-
// Implicit dependency on the specific DNS zone is established via the privateDnsZoneResourceId param reference
10341032
}
10351033

10361034
// The Web socket from front end application connects to Speech service over a public internet and it does not work over a Private endpoint.
@@ -1230,8 +1228,6 @@ module web 'modules/app/web.bicep' = {
12301228
{
12311229
AZURE_BLOB_ACCOUNT_NAME: storageAccountName
12321230
AZURE_BLOB_CONTAINER_NAME: blobContainerName
1233-
// Endpoints constructed from resource names to avoid implicit dependencies on AI service modules,
1234-
// enabling parallel deployment of app services and AI services (customSubDomainName defaults to name)
12351231
AZURE_FORM_RECOGNIZER_ENDPOINT: 'https://${formRecognizerName}.cognitiveservices.azure.com/'
12361232
AZURE_COMPUTER_VISION_ENDPOINT: useAdvancedImageProcessing ? 'https://${computerVisionName}.cognitiveservices.azure.com/' : ''
12371233
AZURE_COMPUTER_VISION_VECTORIZE_IMAGE_API_VERSION: computerVisionVectorizeImageApiVersion
@@ -1335,7 +1331,6 @@ module adminweb 'modules/app/adminweb.bicep' = {
13351331
{
13361332
AZURE_BLOB_ACCOUNT_NAME: storageAccountName
13371333
AZURE_BLOB_CONTAINER_NAME: blobContainerName
1338-
// Endpoints constructed from resource names to avoid implicit dependencies on AI service modules
13391334
AZURE_FORM_RECOGNIZER_ENDPOINT: 'https://${formRecognizerName}.cognitiveservices.azure.com/'
13401335
AZURE_COMPUTER_VISION_ENDPOINT: useAdvancedImageProcessing ? 'https://${computerVisionName}.cognitiveservices.azure.com/' : ''
13411336
AZURE_COMPUTER_VISION_VECTORIZE_IMAGE_API_VERSION: computerVisionVectorizeImageApiVersion
@@ -1443,7 +1438,6 @@ module function 'modules/app/function.bicep' = {
14431438
{
14441439
AZURE_BLOB_ACCOUNT_NAME: storageAccountName
14451440
AZURE_BLOB_CONTAINER_NAME: blobContainerName
1446-
// Endpoints constructed from resource names to avoid implicit dependencies on AI service modules
14471441
AZURE_FORM_RECOGNIZER_ENDPOINT: 'https://${formRecognizerName}.cognitiveservices.azure.com/'
14481442
AZURE_COMPUTER_VISION_ENDPOINT: useAdvancedImageProcessing ? 'https://${computerVisionName}.cognitiveservices.azure.com/' : ''
14491443
AZURE_COMPUTER_VISION_VECTORIZE_IMAGE_API_VERSION: computerVisionVectorizeImageApiVersion
@@ -1575,7 +1569,6 @@ module formrecognizer 'modules/core/ai/cognitiveservices.bicep' = {
15751569
: []
15761570
)
15771571
}
1578-
// Implicit dependency on the specific DNS zone is established via the privateDnsZoneResourceId param reference
15791572
}
15801573

15811574
module contentsafety 'modules/core/ai/cognitiveservices.bicep' = {
@@ -1615,7 +1608,6 @@ module contentsafety 'modules/core/ai/cognitiveservices.bicep' = {
16151608
: []
16161609
)
16171610
}
1618-
// Implicit dependency on the specific DNS zone is established via the privateDnsZoneResourceId param reference
16191611
}
16201612

16211613
// If advanced image processing is used, storage account already should be publicly accessible.

infra/main.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"_generator": {
77
"name": "bicep",
88
"version": "0.41.2.15936",
9-
"templateHash": "13064725685019502849"
9+
"templateHash": "4688738135405051461"
1010
}
1111
},
1212
"parameters": {
@@ -54510,9 +54510,9 @@
5451054510
}
5451154511
},
5451254512
"dependsOn": [
54513-
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageQueue)]",
54514-
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageFile)]",
5451554513
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageBlob)]",
54514+
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageFile)]",
54515+
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageQueue)]",
5451654516
"managedIdentityModule",
5451754517
"virtualNetwork"
5451854518
]

scripts/post_deployment_setup.ps1

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,20 @@ $currentIdentityOid = $null
4343
$currentIdentityDisplay = $null
4444
$principalType = "User"
4545

46-
# Try signed-in user first (single API call to get both id and userPrincipalName)
47-
$userInfo = az ad signed-in-user show 2>$null | ConvertFrom-Json
48-
if ($userInfo) {
46+
# Try signed-in user first
47+
$currentIdentityOid = az ad signed-in-user show --query "id" -o tsv 2>$null
48+
if ($currentIdentityOid) {
4949
$identityType = "user"
50-
$currentIdentityOid = $userInfo.id
51-
$currentIdentityDisplay = $userInfo.userPrincipalName
50+
$currentIdentityDisplay = az ad signed-in-user show --query "userPrincipalName" -o tsv 2>$null
5251
$principalType = "User"
5352
Write-Host "✓ Detected identity type: User ($currentIdentityDisplay)"
5453
} else {
55-
# Fallback to service principal (single API call per resource)
54+
# Fallback to service principal
5655
$spAppId = az account show --query "user.name" -o tsv 2>$null
5756
if ($spAppId -and $spAppId -ne "null") {
58-
$spInfo = az ad sp show --id $spAppId 2>$null | ConvertFrom-Json
59-
if ($spInfo) {
60-
$currentIdentityOid = $spInfo.id
61-
$currentIdentityDisplay = $spInfo.displayName
57+
$currentIdentityOid = az ad sp show --id $spAppId --query "id" -o tsv 2>$null
58+
$currentIdentityDisplay = az ad sp show --id $spAppId --query "displayName" -o tsv 2>$null
59+
if ($currentIdentityOid) {
6260
$identityType = "servicePrincipal"
6361
$principalType = "ServicePrincipal"
6462
Write-Host "✓ Detected identity type: Service Principal ($currentIdentityDisplay, OID: $currentIdentityOid)"
@@ -127,21 +125,21 @@ Write-Host ""
127125
Write-Host "--- Step 1: Set Function App Client Key ---"
128126

129127
# Discover function app
130-
$functionAppName = az functionapp list --resource-group $ResourceGroupName --query "[0].name" -o tsv 2>$null
131-
if (-not $functionAppName) {
128+
$functionApps = az functionapp list --resource-group $ResourceGroupName --query "[].name" -o tsv 2>$null
129+
if (-not $functionApps) {
132130
Write-Warning "⚠ No function apps found in resource group '$ResourceGroupName'. Skipping function key setup."
133131
}
134132
else {
135-
$functionAppName = $functionAppName.Trim()
133+
$functionAppName = ($functionApps -split "`n")[0].Trim()
136134
Write-Host "✓ Discovered function app: $functionAppName"
137135

138136
# Discover key vault
139-
$keyVaultName = az keyvault list --resource-group $ResourceGroupName --query "[0].name" -o tsv 2>$null
140-
if (-not $keyVaultName) {
137+
$keyVaults = az keyvault list --resource-group $ResourceGroupName --query "[].name" -o tsv 2>$null
138+
if (-not $keyVaults) {
141139
Write-Warning "⚠ No Key Vault found. Skipping function key setup."
142140
}
143141
else {
144-
$keyVaultName = $keyVaultName.Trim()
142+
$keyVaultName = ($keyVaults -split "`n")[0].Trim()
145143
Write-Host "✓ Discovered Key Vault: $keyVaultName"
146144

147145
# Ensure the current identity has 'Key Vault Secrets User' role on the Key Vault
@@ -228,12 +226,12 @@ else {
228226
Write-Host ""
229227
Write-Host "--- Step 2: Create PostgreSQL Tables ---"
230228

231-
$serverFqdn = az postgres flexible-server list --resource-group $ResourceGroupName --query "[0].fullyQualifiedDomainName" -o tsv 2>$null
232-
if (-not $serverFqdn) {
229+
$pgServers = az postgres flexible-server list --resource-group $ResourceGroupName --query "[].fullyQualifiedDomainName" -o tsv 2>$null
230+
if (-not $pgServers) {
233231
Write-Host "No PostgreSQL Flexible Server found in resource group. Skipping table creation."
234232
}
235233
else {
236-
$serverFqdn = $serverFqdn.Trim()
234+
$serverFqdn = ($pgServers -split "`n")[0].Trim()
237235
$serverName = $serverFqdn.Split('.')[0]
238236
Write-Host "✓ Discovered PostgreSQL server: $serverName ($serverFqdn)"
239237

scripts/post_deployment_setup.sh

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,23 @@ CURRENT_IDENTITY_OID=""
5151
CURRENT_IDENTITY_DISPLAY=""
5252
PRINCIPAL_TYPE="User"
5353

54-
# Try signed-in user first (single API call to get full JSON, then parse both fields)
55-
USER_JSON=$(az ad signed-in-user show 2>/dev/null || true)
56-
if [ -n "$USER_JSON" ]; then
54+
# Try signed-in user first
55+
CURRENT_IDENTITY_OID=$(az ad signed-in-user show --query "id" -o tsv 2>/dev/null || true)
56+
if [ -n "$CURRENT_IDENTITY_OID" ]; then
5757
IDENTITY_TYPE="user"
58-
CURRENT_IDENTITY_OID=$(echo "$USER_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])" 2>/dev/null || true)
59-
CURRENT_IDENTITY_DISPLAY=$(echo "$USER_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['userPrincipalName'])" 2>/dev/null || true)
58+
CURRENT_IDENTITY_DISPLAY=$(az ad signed-in-user show --query "userPrincipalName" -o tsv 2>/dev/null || true)
6059
PRINCIPAL_TYPE="User"
6160
echo "✓ Detected identity type: User (${CURRENT_IDENTITY_DISPLAY})"
6261
else
63-
# Fallback to service principal (single API call per resource)
62+
# Fallback to service principal — get the SP's app ID from the current account
6463
SP_APP_ID=$(az account show --query "user.name" -o tsv 2>/dev/null || true)
6564
if [ -n "$SP_APP_ID" ] && [ "$SP_APP_ID" != "null" ]; then
66-
SP_JSON=$(az ad sp show --id "$SP_APP_ID" 2>/dev/null || true)
67-
if [ -n "$SP_JSON" ]; then
68-
CURRENT_IDENTITY_OID=$(echo "$SP_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])" 2>/dev/null || true)
69-
CURRENT_IDENTITY_DISPLAY=$(echo "$SP_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['displayName'])" 2>/dev/null || true)
70-
if [ -n "$CURRENT_IDENTITY_OID" ]; then
71-
IDENTITY_TYPE="servicePrincipal"
72-
PRINCIPAL_TYPE="ServicePrincipal"
73-
echo "✓ Detected identity type: Service Principal (${CURRENT_IDENTITY_DISPLAY}, OID: ${CURRENT_IDENTITY_OID})"
74-
fi
65+
CURRENT_IDENTITY_OID=$(az ad sp show --id "$SP_APP_ID" --query "id" -o tsv 2>/dev/null || true)
66+
CURRENT_IDENTITY_DISPLAY=$(az ad sp show --id "$SP_APP_ID" --query "displayName" -o tsv 2>/dev/null || true)
67+
if [ -n "$CURRENT_IDENTITY_OID" ]; then
68+
IDENTITY_TYPE="servicePrincipal"
69+
PRINCIPAL_TYPE="ServicePrincipal"
70+
echo "✓ Detected identity type: Service Principal (${CURRENT_IDENTITY_DISPLAY}, OID: ${CURRENT_IDENTITY_OID})"
7571
fi
7672
fi
7773
fi

0 commit comments

Comments
 (0)