2
votes

I am trying to create a build pipeline in Azure DevOps to deploy an Azure Function Application automatically as part of a continous integration pipeline. When the Function App Deploy step is run, the step fails with 'credentials' cannot be null.

Does anyone know why this happens?

My Build Pipeline:

Build Pipeline

The Log output when the step runs:

Log Output

The only thing that I think that it can be is the Azure Resource Manager subscription which I am using Publish Profile Based Authentication however I have managed to create a similar pipeline for a web application with a deploy option using this authentication and it worked successfully. I just cannot deploy the function application.

2

2 Answers

6
votes

This same problem also ocurrs with publishing web apps I found. There are two different tasks that can be used for web apps to publish and you have to use the right one.

There is a task called Azure Web App Deploy that works.

enter image description here

Also a task called Azure App Service Deploy that doesn't.

enter image description here

This is with Publish Profile Based Authentication.

I found that to deploy the Function Application you can also use the Azure Web App Deploy task and it seems to work.

0
votes

Just for a bit of context on this one.

The Azure Functions task will allow you to select - and even create - a Publish Profile based service connection. No warning is given, but - looking at the code - the task doesn't implement the needed fetching of the push profile.

At least the task - when selecting the service - should warn you that it doesn't handle Publish Profile authentication. At best they should implement it.

For the nerds in here, even more detail.

For tasks that work with Publish Profile authentication - like for example the Web App Deployment - you have something like this happening:

        if (Service Endpoint is Publish Profile) {
          publishProfileUtility.getSCMCredentialsFromPublishProfile();
        }

Look at the link for the actual code.

On the other hand the Azure Functions will simply create the service with the passed endpoint and hope for the best.