0

I try to set up a release pipeline for my Azure function. It's a v2 (.NET Core) project. Locally it works just fine, so I'd like to deploy it to Azure via DevOps.

I created the build pipeline with the standard steps (dotnet restore, dotnet build, etc.). It goes through fine and creates the artifact.

But I struggle to set up correctly the deployment. The pipeline has three tasks:

  1. Stop Azure App Service
  2. Deploy Azure App Service (I selected the Subscription, Function App as App type and the target App service).
  3. Start Azure App Service

The second step fails, and I get the following error message:

Failed to deploy web package to App Service.

If I click on the more detailed log, I get this:

2019-02-04T02:25:43.4893738Z ##[error]Failed to deploy web package to App Service.
2019-02-04T02:25:43.4905786Z ##[error]Error: (2/4/2019 2:25:42 AM) An error occurred when the request was processed on the remote computer.

The content of azure-ci.yaml:

resources:
- repo: self
queue:
  name: Hosted VS2017

steps:
- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore

    projects: '$(Parameters.RestoreBuildProjects)'


- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    projects: '$(Parameters.RestoreBuildProjects)'

    arguments: '--configuration $(BuildConfiguration)'


- task: DotNetCoreCLI@2
  displayName: Test
  inputs:
    command: test

    projects: '$(Parameters.TestProjects)'

    arguments: '--configuration $(BuildConfiguration)'


- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish

    publishWebProjects: false

    projects: '$(Parameters.RestoreBuildProjects)'

    arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'


- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'

My questions are:

  • What do I miss for the deployment task?
  • Could it be something with the build pipeline? So the build artifact is "not in the right format", currently it's a ZIP file
  • Do I need the separate stop / start tasks or they are included in the deployment already?
11
  • It would be great if you can post your yaml file for the build pipeline Commented Feb 4, 2019 at 3:33
  • @LowFlyingPelican I updated the description, it's there Commented Feb 4, 2019 at 3:42
  • You may need to change the "PathtoPublish: $(build.artifactstagingdirectory)" to "PathtoPublish: $(build.artifactstagingdirectory)/Release" in your last step. Commented Feb 4, 2019 at 3:59
  • @LowFlyingPelican I tried, but it doesn't help, the build fails as Not found PathtoPublish: D:\a\1\a\Release Commented Feb 4, 2019 at 4:17
  • Can you try disabling the stop / start steps? Commented Feb 4, 2019 at 6:03

1 Answer 1

0

Try the latest 4.x Azure App Service Deploy task. It uses Run From Package by default, which enforces the atomicity of project deployed on Azure and could avoid many troubles.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.