Deploy Azure functions via CLI

Category: azure functions


Ajo Mathew on Tue, 24 Jan 2017 10:06:22

We have been deploying webjobs and websites using msbuild command line from CI tool using publish profile.

/P:Configuration=Release /p:DeployOnBuild=true  /P:PublishProfileRootFolder="BuildConfigurations\publishProfile" /p:PublishProfile="testprofile" /P:Password=Password

Is there a possibility to follow the same method to publish Azure functions too.

As per the document on azure function is does not mention msbuild. 


Pragna Gopa MSFT on Fri, 27 Jan 2017 19:02:04

We do have support to deploy via msbuild using Visual Studio tools for Azure functions.

  • Follow instructions here and setup VS tools
  • Create Azure function on the portal and get publish settings file
  • Create function project in Visual Studio. Import publish settings for the project (Right click on the project --> Publish -->Import). This creates pubxml file in the Properties\PublishProfiles folder
  • Deploy command: 

Msbuild <projectname.funproj> /t:MsDeployPublish /P:Configuration=Release /p:PublishProfile=<SiteName - Web Deploy.pubxml> /p:Password=<sitepassword from the downloaded publish settings file>

Ajo Mathew on Tue, 14 Feb 2017 06:05:47

Using of the parameter "P:PublishProfileRootFolder" has no effect. Build will fail with error 

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AzureFunctions\Microsoft.AzureFunctions.Publishing.targets(90,3): error MSB4044: The "NormalizeServiceUrl" task was not given a value for the required parameter "ServiceUrl"

MotionKiwi on Fri, 17 Nov 2017 10:44:38

I'm trying to use your solution but getting the error: “The target “MSDeployPublish” does not exist in the project”. I've tried suggestions like adding  Microsoft.Web.WebJobs.Publish to the project and so on, but still getting the same error. Could you please advice?

AhmedElSayed on Fri, 17 Nov 2017 17:57:36

what version of VS did you use to create your project

MotionKiwi on Mon, 20 Nov 2017 07:52:00

I use VS2017 and it works fine while publishing from local machine using VS. The problem was to publish from script, but never mind, we were able to publish not with MsDeployPublish target but with 

/p:DeployOnBuild=True /p:PublishProfile=profile_name /p:Password=password