3
votes

I want to deploy azure webjob using build and release management of visual studio team services. I have created a webjob project and I already deployed from visual studio and I am looking to make the deployment automatic.

Thank you!

1

1 Answers

8
votes

Refer to these steps to publish/deploy web job:

  1. Open VS 2015 and create a Web Job project (e.g. WebJob1)
  2. Right click the project > Publish As Azure WebJob, then it will create webjob-publish-settings.json file (This is required)
  3. Create a build definition, steps:
    • NuGet Installer (Path to solution or packages.config: **\*.sln; Installation type: Restore)
    • Visual Studio Build (Solution: **\*.sln, MSBuild Arguments: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\")
    • Publish Build Artifacts (Path to Publish: $(build.artifactstagingdirectory); Artifact Name: drop; Artifact Type: Server)
  4. Queue build
  5. Create a release definition and link to that build definition(Artifacts tab), tasks:
  6. Azure App Service Deploy (Specify Azure Subscription and App Service name; Package or Folder: $(System.DefaultWorkingDirectory)\**\WebJob1.zip
  7. Create a new release

On the other hand, to configure the Azure service endpoint, you can refer to this blog: Automating Azure Resource Group deployment using a Service Principal in Visual Studio Online: Build/Release Management.