azure-dev icon indicating copy to clipboard operation
azure-dev copied to clipboard

[Aspire] azd up sometimes fails because of not reaching ACR

Open christiannagel opened this issue 1 year ago • 9 comments

When creating new Azure resources and publishing the app, azd up sometimes fails because it cannot access the ACR. Repeating it, everything succeeds. For a better user experience, I think it would be useful to check for the ACR to be available and repeat the check before failing the deployment.

I had this issue when deploying to East US 2 from within Europe. This time creating the Container Apps Environment was a lot faster than previous experiences. It looks like that's why this failed.

Versions: azd version 1.6.1 (commit eba2c978b5443fdb002c95add4011d9e63c2e76f) aspire 8.0.0-preview.3.24105.21/8.0.100

Packaging services (azd package)

SUCCESS: Your application was packaged for Azure in 5 seconds.

Provisioning Azure resources (azd provision)
Provisioning Azure resources can take some time.

Subscription: <redacted>
Location: East US 2

  You can view detailed progress in the Azure Portal:
  https://portal.azure.com/#view/HubsExtension/DeploymentDetailsBlade/~/<redacted>

  (✓) Done: Resource group: rg-codebreaker-packt12us
  (✓) Done: Log Analytics workspace: law-okccxl67xgpc6
  (✓) Done: Container Registry: acrokccxl67xgpc6
  (✓) Done: Container Apps Environment: cae-okccxl67xgpc6
  (✓) Done: Container App: redis
  (✓) Done: Azure Cosmos DB: codebreakercosmosokccxl67xgpc6

SUCCESS: Your application was provisioned in Azure in 3 minutes 16 seconds.
You can view the resources created under the resource group rg-codebreaker-packt12us in Azure Portal:
https://portal.azure.com/#@/resource/subscriptions/<redacted>

Deploying services (azd deploy)

  (x) Failed: Deploying service blazor

ERROR: failed deploying service 'blazor': failing invoking action 'deploy', logging in to registry: failed logging into container registry, token: failed getting ACR token: POST https://acrokccxl67xgpc6.azurecr.io/oauth2/exchange
--------------------------------------------------------------------------------
RESPONSE 404: 404 Not Found
ERROR CODE UNAVAILABLE
--------------------------------------------------------------------------------
Response contained no body
--------------------------------------------------------------------------------
, admin: cannot find registry with name 'acrokccxl67xgpc6' and subscriptionId '<redacted'

ERROR: error executing step command 'deploy --all': failed deploying service 'blazor': failing invoking action 'deploy', logging in to registry: failed logging into container registry, token: failed getting ACR token: POST https://acrokccxl67xgpc6.azurecr.io/oauth2/exchange
--------------------------------------------------------------------------------
RESPONSE 404: 404 Not Found
ERROR CODE UNAVAILABLE
--------------------------------------------------------------------------------
Response contained no body
--------------------------------------------------------------------------------
, admin: cannot find registry with name 'acrokccxl67xgpc6' and <redacted>

After starting the deployment again, everything succeeded.

christiannagel avatar Feb 26 '24 07:02 christiannagel