VSTS release to azure succeeded but url doesn't work - azure

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)

Related

Cefsharp deploy using azure devops

I am trying to deploy a .Net Core application that uses CEFSharp to a app service on azure.
When I publish from VS2019 using a publish profile targeting azure, all necessary files for CEF to work are copied over to the app service and the application works.
If I try to publish using Devops pipeline all the file for CEF are not copied over to the app service and the application does not work.
These are the basic steps I have on the Pipeline
This are the steps I have on the publish
Can anyone help me with ideas why this is happening?

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

Azure function app deploy and release pipeline error

I pushed my .net core function application using visual studio and now setting up release pipeline. I can publish and execute the application just fine and it works great on the Azure portal. However when I see the builds for releases in azure-devOps that slot fails with the following error.
2019-06-19T23:21:33.3543380Z ##[error]Error: Deployment of msBuild generated package is not supported. Change package format or use Azure App Service Deploy task. D:\a\r1\a\_...AVFunctionCore.zip
I am not sure where I need to check in my setup to even start diagnosing the issue.
Here are the pipeline steps.
I create a new stage and then select a template of type (Azure app service deployment)
Under tasks
App type is Function App on Windows
Give the app name, resource group , give the slot and
package folder as
$(System.DefaultWorkingDirectory)/**/AVFunctionCore.zip
Everything else on this is left as default.
Azure function app deploy and release pipeline error
According to the error message:
Deployment of msBuild generated package is not supported. Change
package format or use Azure App Service Deploy task.
It seems you are not using the correct task to publish the generated package. Since the generated package is .zip, you can try the suggestion as error message said use Azure App Service Deploy task.
Azure App Service Deploy task:
Use this task in a build or release pipeline to deploy to a range of
App Services on Azure. The task works on cross-platform agents running
Windows, Linux, or Mac and uses several different underlying
deployment technologies.
The task works for ASP.NET, ASP.NET Core, PHP, Java, Python, Go, and
Node.js based web applications.
The task can be used to deploy to a range of Azure App Services such
as:
Web Apps on both Windows and Linux
Web Apps for Containers Function
Apps on both Windows and Linux
Function Apps for Containers
WebJobs
Apps configured under Azure App Service Environments
Check this blog Visual Studio 2017 Tools for Azure Functions and Continuous Integration with VSTS for some more details.
Hope this helps.
I get predefined pipeline from VS integration. So for those you have the same case:
In GUI/Classic mode Release page -> edit pipeline
Edit task in stage section (this is responsible for deploying)
Replace Azure Web App task with Azure App Service deploy
I have more than one project (web api + azure function) in my solution. For the web app I used the zip file, but for the azure function to work I needed to publish the whole folder.
Azure Function
Package or folder:
$(System.DefaultWorkingDirectory)/_Backend/drop
Web Api
Package or folder:
$(System.DefaultWorkingDirectory)/_Backend/drop/ClientAPI.zip

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

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.

How to Deploy Static html/js App using VSTS Continuous Integration and Azure

I'm trying to deploy an Angular app to Azure Web App using VSTS Continuous Integration.
My repository doesn't contain any .sln .pdb, it's just a static web site.
I have define my build to run npm, gulp, but I don't know how to create an artifact without building the the vs solution.
I would also need to create a release task to publish the web site to azure.
Does anybody has a build definition that would work for this deployment?
Thanks
You can add "Copy and Publish Build Artifacts" task to copy and publish the deployment files to artifact folder that can be used in "Release Management".
And then you can enable "FTP Deployment" for your Azure Web App and use "FTP Uploader" task to publish the files to Azure.
I've solved this a few ways:
Use azure git deploy. https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/ I bake the git credentials into a script, and force commit and publish the site to the azure url.
Use Publish-WebApplicationWebsite.ps1 from the Azure SDK https://azure.microsoft.com/en-us/documentation/articles/vs-azure-tools-publish-webapplicationwebsite-windows-powershell-script/ I recall handing it a folder, but it appears the current version takes in an MSDeploy package.

Resources