Search code examples
azureazure-devopsdeploymentpermissionskudu

Azure DevOps Pipeline failure: missing 'deployments' directory in Azure App Service


I'm experiencing an issue with my Azure DevOps pipeline similar to the one discussed in this thread. The solution in the thread suggests deleting the 'deployment' directory in Azure, but I'm unable to find this directory in my setup.

Context: I am working with an Azure Web Application and trying to deploy through Azure DevOps. I encountered a problem where the deployment fails, resembling the issue described in the linked Stack Overflow question.

Problem: Following the advice in the thread, I attempted to locate and delete the 'deployments' directory in my Azure App Service using Kudu. However, I couldn't find this directory. I'm not sure if it's a permission issue or if the directory is hidden or missing.

Attempts:

  • I've checked the Kudu console and file structure but couldn't locate the 'deployments' folder.
  • I also tried looking for any hidden files or system directories but had no luck.

Questions:

  • Why might the 'deployments' folder be missing in my Azure App Service environment?
  • Is there a way to restore or recreate this folder if it's necessary for deployment?
  • Could this issue be related to user permissions, and if so, how can I verify and adjust them accordingly?

Solution

  • If you are creating your Web App with F1 tier your application will only be available for 60 minutes per day also the compute size will be less. You can utilize Basic or Standard Tier application

    enter image description here

    I tried deploying a .Net application via Azure DevOps and it succeeded without any errors like below:-

    My Azure DevOps yaml pipeline that builds and Deploys a .Net app:-

    trigger:
      branches:
        include:
          - main
    
    jobs:
    - job: Build
      displayName: 'Build and Publish'
      pool:
        vmImage: 'ubuntu-latest'
      steps:
      - task: UseDotNet@2
        displayName: 'Install .NET Core SDK'
        inputs:
          version: '6.x'
    
      - task: DotNetCoreCLI@2
        displayName: 'Restore Dependencies'
        inputs:
          command: 'restore'
          projects: '**/*.csproj'
    
      - task: DotNetCoreCLI@2
        displayName: 'Build Project'
        inputs:
          command: 'build'
          projects: '**/*.csproj'
          arguments: '--configuration Release'
    
      - task: DotNetCoreCLI@2
        displayName: 'Publish Project'
        inputs:
          command: 'publish'
          projects: '**/*.csproj'
          publishWebProjects: true
          arguments: '--configuration Release --output $(Build.ArtifactStagingDirectory)'
          zipAfterPublish: true
    
      - task: PublishPipelineArtifact@1
        displayName: 'Publish Artifact'
        inputs:
          targetPath: '$(Build.ArtifactStagingDirectory)'
          artifactName: 'publishedApp'
          publishLocation: 'pipeline'
    
    - job: Deploy
      displayName: 'Deploy to Azure Web App'
      dependsOn: Build
      pool:
        vmImage: 'ubuntu-latest'
      steps:
      - download: current
        artifact: 'publishedApp'
    
      - task: UseDotNet@2
        displayName: 'Install .NET Core SDK'
        inputs:
          version: '6.x'
    
      - task: AzureWebApp@1
        displayName: 'Azure Web App Deploy'
        inputs:
          azureSubscription: 'xxxx subscription (xxxxxxx6e97cb2a7)'
          appType: 'webApp'
          appName: 'silicon-webapp980'
          package: '$(Agent.BuildDirectory)/**/*.zip'
          deploymentMethod: 'auto'
    

    Output:-

    enter image description here

    enter image description here

    Deployments Folder is present:-

    https://webapp-name0.scm.azurewebsites.net/DebugConsole
    

    Visit Folder - site > deployments > all the Deployments logs are present here. you can also add your Startup.sh script with startup command in your deployments folder

    By default only tools folder will be present inside deployments folder, After deployment the Logs will also be added.

    enter image description here

    If deployments folder is not present inside the site folder you can create it manually:-

    /site > Click + > New Folder > deployments

    enter image description here

    Ideally the deployments folder inside site folder should be created by default, If it is not created or deleted create it manually or deploy a new Web app.

    I also created another Deployment with Free Tier, Even when the deployments folder was not present earlier, It got added automatically after the deployment.