Skip to content

Commit 690b765

Browse files
Merge pull request #291 from microsoft/hb-tempval-fix
refactor: refactoring infra for template validation
2 parents 88da275 + 9825133 commit 690b765

File tree

5 files changed

+25
-33
lines changed

5 files changed

+25
-33
lines changed

.github/workflows/azure-dev.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
- name: Validate Azure Template
2323
uses: microsoft/template-validation-action@v0.4.3
2424
id: validation
25+
with:
26+
useDevContainer: false
2527
env:
2628
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
2729
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}

azure.yaml

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,12 @@ metadata:
1111
name: content-processinge@1.0
1212

1313
hooks:
14-
postdeploy:
14+
postprovision:
1515
posix:
1616
shell: sh
17-
run: |
18-
echo "🧭 Web App Details:"
19-
echo "✅ Name: $CONTAINER_WEB_APP_NAME"
20-
echo "🌐 Endpoint: https://$CONTAINER_WEB_APP_FQDN"
21-
echo "🔗 Portal URL: https://portal.azure.com/#resource/subscriptions/$AZURE_SUBSCRIPTION_ID/resourceGroups/$AZURE_RESOURCE_GROUP/providers/Microsoft.App/containerApps/$CONTAINER_WEB_APP_NAME"
22-
23-
echo "🧭 API App Details:"
24-
echo "✅ Name: $CONTAINER_API_APP_NAME"
25-
echo "🌐 Endpoint: https://$CONTAINER_API_APP_FQDN"
26-
echo "🔗 Portal URL: https://portal.azure.com/#resource/subscriptions/$AZURE_SUBSCRIPTION_ID/resourceGroups/$AZURE_RESOURCE_GROUP/providers/Microsoft.App/containerApps/$CONTAINER_API_APP_NAME"
17+
run: sed -i 's/\r$//' ./infra/scripts/post_deployment.sh; bash ./infra/scripts/post_deployment.sh
2718
interactive: true
2819
windows:
2920
shell: pwsh
30-
run: |
31-
Write-Host "🧭 Web App Details:"
32-
Write-Host "✅ Name: $env:CONTAINER_WEB_APP_NAME"
33-
Write-Host "🌐 Endpoint: https://$env:CONTAINER_WEB_APP_FQDN"
34-
Write-Host "🔗 Portal URL: https://portal.azure.com/#resource/subscriptions/$env:AZURE_SUBSCRIPTION_ID/resourceGroups/$env:AZURE_RESOURCE_GROUP/providers/Microsoft.App/containerApps/$env:CONTAINER_WEB_APP_NAME" -ForegroundColor Cyan
35-
36-
Write-Host "🧭 API App Details:"
37-
Write-Host "✅ Name: $env:CONTAINER_API_APP_NAME"
38-
Write-Host "🌐 Endpoint: https://$env:CONTAINER_API_APP_FQDN"
39-
Write-Host "🔗 Portal URL: https://portal.azure.com/#resource/subscriptions/$env:AZURE_SUBSCRIPTION_ID/resourceGroups/$env:AZURE_RESOURCE_GROUP/providers/Microsoft.App/containerApps/$env:CONTAINER_API_APP_NAME" -ForegroundColor Cyan
21+
run: ./infra/scripts/post_deployment.ps1
4022
interactive: true

infra/main.bicep

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ param enableRedundancy bool = false
7979
@description('Optional. Enable scalability for applicable resources, aligned with the Well Architected Framework recommendations. Defaults to false.')
8080
param enableScalability bool = false
8181

82+
@description('Optional. Enable purge protection. Defaults to false.')
83+
param enablePurgeProtection bool = false
84+
8285
@description('Optional. Tags to be applied to the resources.')
8386
param tags resourceInput<'Microsoft.Resources/resourceGroups@2025-04-01'>.tags = {
8487
app: 'Content Processing Solution Accelerator'
@@ -987,7 +990,7 @@ module avmAppConfig 'br/public:avm/res/app-configuration/configuration-store:0.6
987990
params: {
988991
name: 'appcs-${solutionSuffix}'
989992
location: resourceGroupLocation
990-
enablePurgeProtection: false
993+
enablePurgeProtection: enablePurgeProtection
991994
tags: {
992995
app: solutionSuffix
993996
location: resourceGroupLocation
@@ -1100,7 +1103,7 @@ module avmAppConfig 'br/public:avm/res/app-configuration/configuration-store:0.6
11001103
}
11011104
{
11021105
name: 'APP_AI_PROJECT_ENDPOINT'
1103-
value: avmAiServices.outputs.aiProjectInfo.apiEndpoint
1106+
value: avmAiServices.outputs.aiProjectInfo.?apiEndpoint ?? ''
11041107
}
11051108
{
11061109
name: 'APP_COSMOS_CONNSTR'
@@ -1367,4 +1370,4 @@ output CONTAINER_REGISTRY_NAME string = avmContainerRegistry.outputs.name
13671370
output CONTAINER_REGISTRY_LOGIN_SERVER string = avmContainerRegistry.outputs.loginServer
13681371

13691372
@description('The resource group the resources were deployed into.')
1370-
output resourceGroupName string = resourceGroup().name
1373+
output AZURE_RESOURCE_GROUP string = resourceGroup().name

infra/main.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"_generator": {
77
"name": "bicep",
88
"version": "0.37.4.10188",
9-
"templateHash": "6682056177373814634"
9+
"templateHash": "10045374231657176554"
1010
},
1111
"name": "Content Processing Solution Accelerator",
1212
"description": "Bicep template to deploy the Content Processing Solution Accelerator with AVM compliance."
@@ -154,6 +154,13 @@
154154
"description": "Optional. Enable scalability for applicable resources, aligned with the Well Architected Framework recommendations. Defaults to false."
155155
}
156156
},
157+
"enablePurgeProtection": {
158+
"type": "bool",
159+
"defaultValue": false,
160+
"metadata": {
161+
"description": "Optional. Enable purge protection. Defaults to false."
162+
}
163+
},
157164
"tags": {
158165
"type": "object",
159166
"metadata": {
@@ -38703,10 +38710,10 @@
3870338710
"dependsOn": [
3870438711
"avmContainerApp",
3870538712
"avmManagedIdentity",
38706-
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').contentUnderstanding)]",
38707-
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').aiServices)]",
3870838713
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]",
3870938714
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').openAI)]",
38715+
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').aiServices)]",
38716+
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').contentUnderstanding)]",
3871038717
"logAnalyticsWorkspace",
3871138718
"virtualNetwork"
3871238719
]
@@ -41044,8 +41051,8 @@
4104441051
"dependsOn": [
4104541052
"avmContainerApp",
4104641053
"avmManagedIdentity",
41047-
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').contentUnderstanding)]",
4104841054
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]",
41055+
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').contentUnderstanding)]",
4104941056
"virtualNetwork"
4105041057
]
4105141058
},
@@ -50941,7 +50948,7 @@
5094150948
"value": "[parameters('resourceGroupLocation')]"
5094250949
},
5094350950
"enablePurgeProtection": {
50944-
"value": false
50951+
"value": "[parameters('enablePurgeProtection')]"
5094550952
},
5094650953
"tags": {
5094750954
"value": {
@@ -51060,7 +51067,7 @@
5106051067
},
5106151068
{
5106251069
"name": "APP_AI_PROJECT_ENDPOINT",
51063-
"value": "[reference('avmAiServices').outputs.aiProjectInfo.value.apiEndpoint]"
51070+
"value": "[coalesce(tryGet(reference('avmAiServices').outputs.aiProjectInfo.value, 'apiEndpoint'), '')]"
5106451071
},
5106551072
{
5106651073
"name": "APP_COSMOS_CONNSTR",
@@ -58237,7 +58244,7 @@
5823758244
},
5823858245
"value": "[reference('avmContainerRegistry').outputs.loginServer.value]"
5823958246
},
58240-
"resourceGroupName": {
58247+
"AZURE_RESOURCE_GROUP": {
5824158248
"type": "string",
5824258249
"metadata": {
5824358250
"description": "The resource group the resources were deployed into."

infra/scripts/post_deployment.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ set -e
55

66
echo "🔍 Fetching container app info from azd environment..."
77

8-
echo "Started at: $(date)"
9-
108
# Load values from azd env
119
CONTAINER_WEB_APP_NAME=$(azd env get-value CONTAINER_WEB_APP_NAME)
1210
CONTAINER_WEB_APP_FQDN=$(azd env get-value CONTAINER_WEB_APP_FQDN)

0 commit comments

Comments
 (0)