Receiving an error "web app not found"

Tahira Nawaz 110 Reputation points
2023-11-15T07:47:02.99+00:00

actually i am facing an error "web app not found" i created an azure devops pipeline in which i used multiple task ..i used 3stages and multiple task one is for ceating web app in azure and other is build and next is for deployment of code ...but when last task AzureRmWebAppDeployment@4 is running for code deployment its generating an error web app not found ...even web app created successfully within 1st stage: WebApplication ...i have also check on az portal (webapp created successfully on portal) ...but after 5 to 15 minutes i run same piepline again than error automatically resolve so i dont understand what is the reason ? why this error is coming even after sunccessfully creation of web app..
Is it possible the issue is occur due to too many application in deleted state in azure?becuase now in the list of deleted web app there are round about 100 application

this is the piepline which i am using ....even few days before this piepline was working 100% fine but now generating error "web app not found"

#NAME THE PIPELINE SAME AS FILE (WITHOUT ".yml")
# trigger:
#     - main

resources:
  repositories:
    - repository: self
      trigger: none

variables:
  Group: "variable"
  azureServiceConnection: "webapp"
  bicepFile: ".azure/bicep/main.bicep"
  number: "003"
  location: "eastus"
  resourcegroup: "webapp-tahira-$(number)"
  AppName: "$(resourcegroup)-$(location)"

stages:
- stage: WebApplication 
  displayName: Create web application inn azure 
  jobs:
  - job: web
    pool:
      vmImage: ubuntu-latest
    steps:
      - task: AzureResourceManagerTemplateDeployment@3
        inputs:
          deploymentScope: 'Subscription'
          azureResourceManagerConnection: '$(azureServiceConnection)'
          subscriptionId: ''
          location: '$(location)'
          templateLocation: 'Linked artifact'
          csmFile: '$(bicepFile)'
          overrideParameters: '-webAppName $(AppName) -resourcegroup $(resourcegroup) -location $(location)'
          deploymentMode: 'Incremental'
          deploymentName: 'bicepDeployment'
          deploymentOutputs: 'bicepOutputs'

- stage: Build
  displayName: Build .Net Core Solution
  jobs:
  - job: Build
    pool:
      vmImage: ubuntu-latest
    steps:
    - task: Bash@3
      inputs:
        targetType: 'inline'
        script: |
          echo "#####################"
          echo "these are the restore files in directory" 
          echo "#####################"
          dotnet restore .**/*.sln
          echo "#####################"
          echo "these are the build files in directory" 
          echo "#####################"
          dotnet build .**/*.sln
          # dotnet build --configuration Release
          echo "#####################"
          echo "these are the test files in directory" 
          echo "#####################"
          dotnet test tests/UnitTests/*.csproj
          echo "#####################"
          echo "these are the publish files in directory" 
          echo "#####################"
          dotnet publish src/Web/Web.csproj --output $(Build.ArtifactStagingDirectory)/Webtahira 
          ath $(Build.ArtifactStagingDirectory)
          echo "these are the files in directory"

    - task: PublishBuildArtifacts@1
      displayName: Publish Artifacts ADO - Website
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'Website'
        publishLocation: 'Container'    
      
- stage: Deploy
  displayName: Deploy to an Azure Web App
  
  jobs:
  - deployment: Deploy
    environment: approvals
    pool:
      vmImage: 'windows-2019'
    strategy:
      runOnce:
        deploy:
          steps:

          - task: DownloadBuildArtifacts@1
            inputs:
              buildType: 'current'
              downloadType: 'single'
              artifactName: 'Website'
              downloadPath: '$(Build.ArtifactStagingDirectory)'

          - task: AzureRmWebAppDeployment@4
            inputs:
              ConnectionType: 'AzureRM'
              azureSubscription: '$(azureServiceConnection)'
              appType: 'webApp'
              WebAppName: '$(AppName)'
              packageForLinux: '$(Build.ArtifactStagingDirectory)/**/Webtahira'
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,960 questions
0 comments No comments
{count} votes

Accepted answer
  1. brtrach-MSFT 17,741 Reputation points Microsoft Employee Moderator
    2023-11-21T17:32:42.2766667+00:00

    @Tahira Nawaz This error can occur if the web app is not found in the specified resource group or location.

    To troubleshoot this issue, you can try the following steps:

    Check if the web app is still present in the specified resource group and location. You can do this by logging into the Azure portal and navigating to the resource group.

    Check the logs of the AzureRmWebAppDeployment@4 task to see if there are any specific error messages that can help identify the issue.

    Try running the pipeline again after waiting for some time to see if the issue resolves itself.

    If the issue persists, you can try creating a new web app and deploying the code to it to see if the issue is specific to the current web app.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Tahira Nawaz 110 Reputation points
    2023-11-26T14:51:56.1133333+00:00

    thanks for your suggestion...but I had tried alot I don't understand why error coming actually I created this pipeline few days ago when I created at this time it works 100 percent fine but after few days passed I run it again then it's generating an error web app not found even I check side side by side on azure portal while running pipeline. In azure portal web app was creating successfully but the error is coming web app not found even I add additional stage for checking availability of web app in this state web app showing in output successfully but in deployment stage same error still coming"web app not found".but if I wait for few minutes and run again this pipeline without any changing than error remove automatically..I tried really hard but not understanding the actual reason of this error ...I just want to know the reason...if you help me in this than I will be really thankful to you


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.