azure-devopsazure-pipelinesazure-pipelines-release-pipelineazure-pipelines-release-task

Getting a "Credentials cannot be null" error when trying to deploy via a devops release pipeline


I'm trying to deploy an Azure Function from an Azure DevOps repo via an DevOps pipeline and release. When it gets to the deploy stage I get an error message stating that the credentials can not be null, but knowhere in the canned release components is there a place for any credentials and none of my other pipelines ever have this problem.

I see some old references here but no clear answers.

Anyone have suggestions or fixes?


Solution

  • Credentials cannot be null

    I can reproduce this issue in my pipeline.

    enter image description here

    The cause of the issue is that you are using the Publish Profile type Azure Resource Manager Service Connection. And Azure Function App deploy task will not able to read the credentials of the Publish Profile type service connection.

    Here are two methods to solve the issue:

    1.You can change to use the Azure Web App task to deploy the Function APP.

    For example:

    enter image description here

    Note: Azure Web APP task can be used to deploy to Web APP and Function App.

    2.You can change the Service Connection type to Service Principal.

    For example:

    enter image description here