Skip to content

Need to update predeploy.ps1#27

Open
lormadus wants to merge 1 commit intomicrosoft-foundry:mainfrom
lormadus:patch-1
Open

Need to update predeploy.ps1#27
lormadus wants to merge 1 commit intomicrosoft-foundry:mainfrom
lormadus:patch-1

Conversation

@lormadus
Copy link
Copy Markdown

@lormadus lormadus commented Apr 9, 2026

Hello,

I suggest to avoid ACR deployment issue during container deployment, need to chagne predeploy.ps1 like as below,

$buildOutput = az acr build --registry $acrName --image "web:$imageTag" ` $buildOutput = az acr build --registry $acrName --resource-group $env:AZURE_RESOURCE_GROUP_NAME --image "web:$imageTag" `

Copilot AI review requested due to automatic review settings April 9, 2026 09:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the pre-deploy hook to make ACR cloud builds more reliable by explicitly providing a resource group to az acr build, helping avoid registry resolution/deployment issues during container deployment.

Changes:

  • Add --resource-group $env:AZURE_RESOURCE_GROUP_NAME to the az acr build invocation in deployment/hooks/predeploy.ps1.

if ($backendClientId) { $acrBuildArgs += @("--build-arg", "ENTRA_BACKEND_CLIENT_ID=$backendClientId") }
if ($appInsightsConnStrEscaped) { $acrBuildArgs += @("--build-arg", "APPLICATIONINSIGHTS_FRONTEND_CONNECTION_STRING=$appInsightsConnStrEscaped") }
$buildOutput = az acr build --registry $acrName --image "web:$imageTag" `
$buildOutput = az acr build --registry $acrName --resource-group $env:AZURE_RESOURCE_GROUP_NAME --image "web:$imageTag" `
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

az acr build is now using $env:AZURE_RESOURCE_GROUP_NAME directly, but this script already resolves the resource group via Get-AzdValue into $resourceGroup (with a fallback when env vars aren’t present). Using the env var here can make ACR cloud builds fail when the hook is run without injected env vars even though azd env get-value works. Use $resourceGroup (and fail fast if it’s empty) for consistency with the rest of the script.

Suggested change
$buildOutput = az acr build --registry $acrName --resource-group $env:AZURE_RESOURCE_GROUP_NAME --image "web:$imageTag" `
if ([string]::IsNullOrWhiteSpace($resourceGroup)) { throw "AZURE_RESOURCE_GROUP_NAME is required for ACR cloud build" }
$buildOutput = az acr build --registry $acrName --resource-group $resourceGroup --image "web:$imageTag" `

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants