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:
The Log output when the step runs:
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.
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.
Also a task called Azure App Service Deploy that doesn't.
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.
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.
Related
I am trying to deploy my backend code to azure app services using the GITHUB actions, the code has been committed and in the action, yml file is also generated, and after clicking the build it fails with an error. Error: Process completed with exit code 1.
It depends which Action you used.
It is recommended to start with "Deploying Node.js to Azure App Service" and its prerequisites (creating an Azure App Service plan, creating a web app, configuring an Azure publish profile and create an AZURE_WEBAPP_PUBLISH_PROFILE secret.)
You can then create your workflow, following the example "deployments/azure-webapps-node.yml" as a possible template, for you to adapt.
We have been developing an Angular application on Azure DevOps. My company wants to have the app running on another cloud service. Can anyone tell me: Can we create a pipeline that will deploy the production version of our application from build in Azure to this other cloud service? What are the pitfalls or potential obstacles? Is anyone doing it already that could speak to it from your experience? Thanks in advance.
If you want to deploy Angular application on Azure DevOps to Azure App Service via Azure Pipelines, you could follow below steps.
Create a build pipeline, add a npm task to install the npm packages required by the Angular application
use npm task to build the application and produce the assets to be published on the web server
Add a Publish Build Artifact task that generates the artifacts which will be provided later on as an input to release definition
The last step is to add a CD pipeline which will deploy the artifacts created by the build to the Azure Web App by using this Azure App Service Deploy task. See this tutorial for details.
If want to deploy to other cloud service, this doc provides the system-defined tasks, you could review it to find if there are existing available tasks. If not, you may need to develop a custom pipelines task extension or find if there are existing extensions in the Azure DevOps Marketplace.
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
I use the Deploy Azure App Service VSTS task to deploy an asp dotnet core API to an Azure API app using the Publish using Web Deploy option. The task runs without any errors but somehow I have to restart the API to get the new version.
Is that intended? Is there any flag that I can set to immediately get the deployment "live"? As a workaround I can add a restart task but I hope there is another way....
Are you using App Service Local Cache? https://learn.microsoft.com/en-us/azure/app-service/app-service-local-cache
If you are you will need to remove WEBSITE_LOCAL_CACHE_OPTION = Always property of your web app to have your publish show right away.
Otherwise you can always use a deployment slot to test your app before swapping in production.
In Visual Studio Team Services, I would like to specify the Azure Subscription via a variable (see image below). The reason for this is that our ops team maintains the NON-PROD and PROD environments on different subscriptions.
However, when I do this I get the following in the log:
##[section]Starting: Azure App Service Deploy: XXXXfunc
==============================================================================
Task : Azure App Service Deploy
Description : Update Azure App Service using Web Deploy / Kudu REST APIs
Version : 2.1.10
Author : Microsoft Corporation
Help : [More Information](https://aka.ms/azurermwebdeployreadme)
==============================================================================
[RESOURCE_NAME] exists false
##[warning]Can\'t find loc string for key: CouldnotfetchacccesstokenforAzureStatusCode
##[error]CouldnotfetchacccesstokenforAzureStatusCode 401 Unauthorized
##[section]Finishing: Azure App Service Deploy: XXXXfunc
If I set the subscription using the drop down, then it all works fine.
Is this possible to do? If so, how?
UPDATE:
I am using App Service here as a simple example, but I also have a collection of Azure PowerShell tasks joined into a single Task Group. Each of these tasks need to have the subscription specified. If I can't pass a Azure sub in, then I'll have to either clone the Task Group or just list each step individually.
Its easier (and fits with how the system has been designed), if instead of this, you just use the Releases workflow to setup your dev/test environment, with the app service deploy pointing at that subscription, then clone that environment, call the new one "prod", and modify the release step in that environment to point at the other subscription. You can then also add governance (ie. email approval processes) around the build and deploy, and ensure the exact same build artifact is deployed to both environments, but when you want them to. I wrote a blog post last year to take you through this step by step, see https://russellyoung.net/2016/11/09/continuous-deployment-of-a-asp-net-core-app-to-azure-using-vsts/