Skip to content

Fix Bicep compilation errors preventing azd up/down in AI Gallery template #400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -483,3 +483,8 @@ env/
venv/
myvenv/
ENV/

# Bicep compiled outputs
infra/**/*.json
!infra/main.parameters.json
!infra/abbreviations.json
4 changes: 2 additions & 2 deletions infra/core/ai/cognitiveservices.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ resource deployment 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01
name: deployment.name
properties: {
model: deployment.model
raiPolicyName: contains(deployment, 'raiPolicyName') ? deployment.raiPolicyName : null
raiPolicyName: deployment.?raiPolicyName ?? null
}
sku: contains(deployment, 'sku') ? deployment.sku : {
sku: deployment.?sku ?? {
name: 'Standard'
capacity: 20
}
Expand Down
18 changes: 14 additions & 4 deletions infra/core/host/container-apps.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,19 @@ module containerAppsEnvironment 'container-apps-environment.bicep' = {
}
}

module containerRegistry 'container-registry.bicep' = {
module containerRegistryInCustomRG 'container-registry.bicep' = if (!empty(containerRegistryResourceGroupName)) {
name: '${name}-container-registry'
scope: resourceGroup(containerRegistryResourceGroupName)
params: {
name: containerRegistryName
location: location
adminUserEnabled: containerRegistryAdminUserEnabled
tags: tags
}
}

module containerRegistryInCurrentRG 'container-registry.bicep' = if (empty(containerRegistryResourceGroupName)) {
name: '${name}-container-registry'
scope: !empty(containerRegistryResourceGroupName) ? resourceGroup(containerRegistryResourceGroupName) : resourceGroup()
params: {
name: containerRegistryName
location: location
Expand All @@ -36,5 +46,5 @@ output defaultDomain string = containerAppsEnvironment.outputs.defaultDomain
output environmentName string = containerAppsEnvironment.outputs.name
output environmentId string = containerAppsEnvironment.outputs.id

output registryLoginServer string = containerRegistry.outputs.loginServer
output registryName string = containerRegistry.outputs.name
output registryLoginServer string = !empty(containerRegistryResourceGroupName) ? containerRegistryInCustomRG.outputs.loginServer : containerRegistryInCurrentRG.outputs.loginServer
output registryName string = !empty(containerRegistryResourceGroupName) ? containerRegistryInCustomRG.outputs.name : containerRegistryInCurrentRG.outputs.name
8 changes: 4 additions & 4 deletions infra/core/security/keyvault-secrets.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ resource keyVaultSecret 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = [for se
tags: tags
properties: {
attributes: {
enabled: contains(secret, 'enabled') ? secret.enabled : true
exp: contains(secret, 'exp') ? secret.exp : 0
nbf: contains(secret, 'nbf') ? secret.nbf : 0
enabled: secret.?enabled ?? true
exp: secret.?exp ?? 0
nbf: secret.?nbf ?? 0
}
contentType: contains(secret, 'contentType') ? secret.contentType : 'string'
contentType: secret.?contentType ?? 'string'
value: secret.value
}
}]
2 changes: 1 addition & 1 deletion infra/core/storage/storage-account.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ resource storage 'Microsoft.Storage/storageAccounts@2023-01-01' = {
resource container 'containers' = [for container in containers: {
name: container.name
properties: {
publicAccess: contains(container, 'publicAccess') ? container.publicAccess : 'None'
publicAccess: container.?publicAccess ?? 'None'
}
}]
}
Expand Down
5 changes: 4 additions & 1 deletion infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ module storage 'core/storage/storage-account.bicep' = {
location: storageResourceGroupLocation
tags: updatedTags
publicNetworkAccess: 'Enabled'
allowBlobPublicAccess: false
allowSharedKeyAccess: false
defaultToOAuthAuthentication: true
sku: {
name: 'Standard_LRS'
}
Expand All @@ -521,7 +524,7 @@ module storage 'core/storage/storage-account.bicep' = {
containers: [
{
name: storageContainerName
publicAccess: 'Blob'
publicAccess: 'None'
}
]
}
Expand Down