How to deploy azure webjob automatically via VS Team Services - release - azure

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!

Refer to these steps to publish/deploy web job:
Open VS 2015 and create a Web Job project (e.g. WebJob1)
Right click the project > Publish As Azure WebJob, then it will create webjob-publish-settings.json file (This is required)
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)
Queue build
Create a release definition and link to that build definition(Artifacts tab), tasks:
Azure App Service Deploy (Specify Azure Subscription and App Service name; Package or Folder: $(System.DefaultWorkingDirectory)\**\WebJob1.zip
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.

Related

Deploying .net core 3.1 web app to Azure Linux App Service

I've set up the release in Azure Devops to deploy a .net core 3.1 app to a Linux App Service in Azure. This seems to push the code to Azure, but to a really weird path:
Index of /wwwroot/Content/d_C/a/1/s/[MyProject]/obj/Release/netcoreapp3.1/PubTmp/Out/
This contains all the dlls and then a wwwroot directory which has all the files & folders found in my web project.
Here is my Release set up. Anyone have any ideas why my release isn't publishing to /home/site/wwwroot/? Others have said that this is where the site should be published to. Is there something I need to set up in the Azure portal or is this a Devops thing?
This wired path should not relevant with the configuration of Azure app service deploy task or Azure portal (Just ensure the Physical path value in Azure portal is site/wwwroot).
I guess you were using Visual studio build task to build your project, right? Because I faced the similar path structure if I use VSbuild task to build my .net core app. If yes, what the others told you is correct. This is the default action if you are using Visual studio build task in Build pipeline.
Others have explained this in detail, also provided the corresponding solution. You can refer to this #1 for explanation of this default action. And check this #2 for work around.
Therefore I can safely assume that you are developing ASP.NET Core 3.0
app to be hosted in Ubuntu. Any .NET Core 3.0 (or later) application
means that you should rely on the dotnet build instead of using
VSBuild.
Also you had stated that you will host the app on Ubuntu 18.x, then
you should also run the build on Azure DevOps agent that runs on
Ubuntu. This means you should only use dotnet build in
DotNetCoreCLI#2 task, because VSBuild task only runs on Windows
based agent, not Ubuntu and it is intended to compile .NET Framework
and other platform other than .NET Core.
So, to achieve what you want, here you need using dotnet build task to build your .net core 3.1 project.
- task: DotNetCoreCLI#2
displayName: Build
inputs:
command: 'build'
projects: PATH/TO/YOUR/Project.csproj
arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration Release

VSTS release to azure succeeded but url doesn't work

I have a simple MVC application. In VSTS, build is success and release to Azure WebApp is also success. But azure url doesn't work. Application runs & works in local. Azure WebApp also looks good. Not sure if its issue with Azure or VSTS Release pipeline. IS Azure WebApp capable of running MVC applications?
My VSTS release pipe-line:
First, the MVC application (MVC template project in Visual Studio) can be run on Azure Web App.
Secondly, the App Service URL option of Azure App Service Deploy task Provide a name, like FabrikamWebAppURL for the variable for the AzureRM Web App Hosted URL. The variable can be used as $(variableName), like $(FabrikamWebAppURL) to refer to the Hosted URL of the AzureRM Web App in subsequent tasks, such as PowerShell.
Thirdly, you can refer to these steps below to build and deploy application:
NuGet Tool Installer (Version of NuGet.exe to install: 4.3.0)
NuGet restore
Visual Studio Build (MSBuild Arguments: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)")
Publish Build Artifacts (Path to publish: $(build.artifactstagingdirectory))
Create a new release definition
Azure App Service Deploy (Package or folder: $(System.DefaultWorkingDirectory)/**/*.zip)

TFS 2015 is missing the "Deploy Azure App Service" task

I'm using TFS 2015 (Microsoft Visual Studio Team Foundation Server
Version 14.102.25423.0)
but, I could only see "Azure Web App Deployment" Task, but not the "Deploy Azure App Service" task. How do I get the App Service task in my TFS Build definition.
This is the task I see in my TFS-
enter image description here
This is the task I want-
enter image description here
The Azure Web App Deployment task has been deprecated. But in TFS 2015, it still using it and in TFS 2017 and VSTS, it has been updated to use the Azure App Service Deploy task.
So if you want to use Azure App Service Deploy task, you could upload this task using tfx command to manually. The source files of the Azure App Service Deploy task is on the Github site. You could clone down the repository first.
tfx command to upload a build task:
http://donovanbrown.com/post/how-do-i-upload-a-custom-task-for-build
https://github.com/Microsoft/tfs-cli

Error Deploying to Azure in Build pipeline

I'm working on creating a build pipeline that to compile an ApiWebApp and deploy it to Azure from Visual Studio Online. My build flow is:
Visual Studio Build
Publish Build Artifacts
Azure Web App Deployments
My questions are:
Is it reasonable to deploy an API App from Visual Studio Online to Azure?
Hoping the answer to this is yes.
Do I have the right steps in my pipeline?
In the Azure Web App Deployments step, what should I enter for the 'Web Deploy Package' ?
Yes, it is reasonable, and you have the right build steps in your build definition.
You need to have a check on this blog, it describes the details on how to deploy an Azure Web Site using the new build system in Visual Studio Online.
Here are some important steps I would like to highlight from there:
Firstly, you need to register your Azure subscription in TFS.
Secondly, in the Visual Studio Build step, pass the following argument to MSBuild: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.stagingDirectory)" These specific settings will create a web deploy package and put it in the staging directory of the build definition.
Thirdly, in the Azure Web App Deployment step, set Web Deploy Package $(build.stagingDirectory)\projectname.zip.
Yes it is reasonable.
Here are the steps:
Step 1: Create a team project
Step 2: Check in a project to source control
Step 3: Connect the project to Azure (In azure portal)
Step 4: Trigger a rebuild and redeploy your project
Here is a complete steps on how you can do it:
https://azure.microsoft.com/en-us/documentation/articles/cloud-services-continuous-delivery-use-vso/
In the package text box you can enter:
($build.stagingDirectory)YourProjectName.zip

Azure Continuous Deployment - Setup Publishing with VSO

We've been able to setup Azure Continuous Deployment with some VSO Team Projects, but not others. Any idea why we are getting this error in the Azure Management Portal? Perhaps it depends on the age of the team project.
Unable to find AzureContinuousDeployment.11.xaml in TeamProject see [Link]
We've followed the directions suggested:
Integrating Azure Continuous Integration with VSO
Add Build Template AzureContinuousDeployment.11.xaml to $/[TeamProject]/BuildProcessTemplate
Created Build Definition in [TeamProject] referencing AzureContinuousDeployment.11.xaml in Step 1 (i.e. Registering the Template)
Proceed with "Set up publishing with Visual Studio Online". Enter VSO host and select [TeamProject].
I can see there are connected services under the [Team Project] in VSO (under Team Project Admin -> Services).
Turns out the Azure Portal/VSO error message needs updated to reflect new Azure Continuous Deployment updates for TFS 2013 (Microsoft.TeamFoundation.Build.Client).
Proper Error Message
Unable to find TfvcContinuousDeploymentTemplate.12.xaml in [TeamProject] see [Link]
The fix is to upload the TFS 2013 Azure CD template and create a build definition to register the template with the [TeamProject].
This is only necessary for older VSO projects that don't get the default Azure CD build template.

Resources