Azure / modern-web-app-pattern-dotnet

The Modern Web App Pattern is a set of objectives to help you apply an iterative change to modernize a cloud deployed monolith. This content builds on the Reliable Web App. This repo contains a reference implementation of a Modern Web App for .NET.
https://aka.ms/eap/mwa/dotnet/doc
MIT License
79 stars 8 forks source link

Error while deploying MWA to Azure #264

Open mfaulcon opened 2 weeks ago

mfaulcon commented 2 weeks ago

Describe the bug While executing step 5 in the [Steps to deploy the reference implementation](Steps to deploy the reference implementation) using the option for Visual Studio, the error below was observed:

  (✓) Done: Resource group: rg-sandbox-mwa-eus (337ms)
  (✓) Done: Log Analytics workspace: log-5mhbf4d3c7clm (332ms)
  (✓) Done: Application Insights: appi-5mhbf4d3c7clm (599ms)
  (✓) Done: Azure Front Door / CDN profile: afd-5mhbf4d3c7clm (608ms)
  |  =====| Creating/Updating resources
ERROR: error executing step command 'provision': deployment failed: error deploying infrastructure: deploying to subscription:

Deployment Error Details:
InvalidTemplate: Deployment template validation failed: 'The template output reference to 'Microsoft.Resources/deployments/application-sql-server-5mhbf4d3c7clm' requires an API version. Please see https://aka.ms/arm-syntax for usage details.'.

Examining the deployment error in the Azure portal showed this message:

{"code":"InvalidTemplate","message":"Deployment template validation failed: 'The template output reference to 'Microsoft.Resources/deployments/application-sql-server-5mhbf4d3c7clm' requires an API version. Please see https://aka.ms/arm-syntax for usage details.'.","additionalInfo":[{"type":"TemplateViolation","info":{"lineNumber":0,"linePosition":0,"path":""}}]}

To Reproduce Steps to reproduce the behavior:

  1. Complete steps 1-4 of the [Steps to deploy the reference implementation](Steps to deploy the reference implementation), using the optional instructions for Visual Studio.
  2. Execute step 5, 'azd up'
  3. See error

Expected behavior The MWA azure infrastructure is provisioned successfully.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context N/A

mjrousos commented 2 weeks ago

Thanks for reporting the issue, @mfaulcon. We'll take a look!

mjrousos commented 1 week ago

I haven't been able to reproduce this locally. Can you share more details on the error? When you look at the deployment in the Azure Portal, drill down into the nested deployments by clicking on the name of the failed deployment as many times as possible and then share which resource is failing to deploy and the operation details?

mfaulcon commented 1 week ago

I haven't been able to reproduce this locally. Can you share more details on the error? When you look at the deployment in the Azure Portal, drill down into the nested deployments by clicking on the name of the failed deployment as many times as possible and then share which resource is failing to deploy and the operation details?

The details you see in my original post are the details from the nested deployment. To add further information, in the naming.overrides.jsonc file, I had added overrides for "resourceGroup" and "sqlResourceGroup", among others. This seems to be an issue in application-resources.bicep, line 70, and again in line 277. Once I tried again with the resource groups set to the same value, the deployment completed.

I will note, however, that the execution of create-app-registrations.ps1 failed immediately following - still investigating that.

mfaulcon commented 3 days ago

I will note, however, that the execution of create-app-registrations.ps1 failed immediately following - still investigating that.

Update - Not sure why, but in order to make create-app-registrations.ps1 work, I had to add the line below:

# Set defaults
+$global:resourceGroups = @{}
$defaultFrontEndAppRegistrationName = "$(Get-WorkloadName -ResourceGroupName $ResourceGroupName)-$(Get-WorkloadEnvironment -ResourceGroupName $ResourceGroupName)-front-webapp-$(Get-WorkloadResourceToken -ResourceGroupName $ResourceGroupName)"