robsta
robsta

Reputation: 426

Using VSTS to publish Azure Function to Zip file

I am trying to use VSTS to publish a project that contains an Azure Function. My MSBuild step is passing the following build arguments

/p:Configuration=Release /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\MyFunctions.$(Build.BuildNumber)-dev.zip" /p:DeployIisAppPath="Default Web Site"

This is giving me a Zip where the folder structure of \Content\D_C\a\3\s\MyFunctions\obj\Release\net461\PubTmp\Out. The Out directory has the content I need and what I'd expect to be the root

The folder structure I need to push a Zip is

enter image description here

As documented Here

Can anyone advise on what I am doing wrong here?

Thanks

Upvotes: 2

Views: 3063

Answers (2)

starian chen-MSFT
starian chen-MSFT

Reputation: 33708

With Azure App Service Deploy task and Publish using Web Deploy option, it won’t remain the folder structure and the content files will be in wwwroot folder of azure app service. So you don’t need to care the package folder structure.

Otherwise, you can publish the app through FileSystem publish method (e.g. /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:publishUrl="$(build.artifactstagingdirectory)\\" /p:DeployDefaultTarget=WebPublish), then zip files through Archive files task, after that you can deploy it through Zip push deployment way (Azure CLI or PowerShell)

Zip push deployment for Azure Functions

Upvotes: 0

Kai Walter
Kai Walter

Reputation: 4001

I do it in a 2 step process

  1. build with a VSTS Build task with settings /p:DeployOnBuild=true /p:DeployTarget=Package;CreatePackageOnPublish=true
  2. ZIP it with a VSTS Archive Files task. Here I leave the option to Prefix root folder name... unchecked.

Sample: sample Archive files task

Upvotes: 2

Related Questions