Skip to main content

Azure Function Published with Azure DevOps has Extra Folder at Root

Author by Nathan Lasnoski

I was deploying an Azure Function with Azure DevOps and was running into a problem where an extra folder was created at the root of the Files directory when deploying. It looked like this:

I discovered that in the deployment file the root directory was being included in the deployed zip file and needed to be excluded in order for the correct file structure to be created. You can see that I’ve indicated “includeRootFolder” as “false” below.

- task: ArchiveFiles@2
    rootFolderOrFile: '$(Build.ArtifactStagingDirectory)'
    includeRootFolder: false
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    replaceExistingArchive: true

The full code to publish to an Azure Function through the build pipeline is here, so give it a shot if you are running into more problems.


Nathan Lasnoski


Nathan Lasnoski

Chief Technology Officer