Reputation: 9516
I have an Azure Functions App developed in Visual Studio using C# and Microsoft.NET.Sdk.Function.
I need to build and deploy this app from our Jenkins build server. What is the recommended approach? MSBuild? MSDeploy? Azure Functions CLI? FTP? I can't use the Source Control or VSTS deployment.
Some sample scripts would be appreciated!
Upvotes: 3
Views: 3093
Reputation: 2438
msbuild is OK, please refer to the link here for more info
msbuild AzureFuncTest.sln /t:Rebuild /p:Configuration=Debug;PublishProfile=LocalDebug;DeployOnBuild=true;VisualStudioV
ersion=15.0
Upvotes: 0
Reputation: 7521
You can set up continuous deployment from the configuration of the functions app. At the end of the day, you want to "publish" your applications leveraging whatever tool you like on the build server, and then have those assets deployed as the function app.
To set up the deployment, navigate to your function app.
This is similar for other options - for example, if you choose DropBox it will monitor the location and update once the files are changed/refreshed.
There is a full article on this capability here:
Upvotes: 0
Reputation: 6101
That's an interesting solution! I explored the options a while back and for now just FTP and wait for the portable Functions CLI or use the CLI publish which zips up.
Upvotes: 0
Reputation: 9516
I was able to achieve the deployment in 2 steps. First, create a zip package using msbuild:
msbuild FunctionApp.sln /p:Configuration=Release /p:DeployOnBuild=true
/p:WebPublishMethod=Package /p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true
/p:DesktopBuildPackageLocation="c:\output.zip" /p:DeployIisAppPath="Default Web Site"
Next, the package should be uploaded to azure blob storage (SAS tokens, etc) And then, I utilized MSDeploy extension of Azure AppService that downloads the package and deploys it into your Azure Functions service:
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/sites",
"name": "[variables('functionAppName')]",
"kind": "functionapp",
"dependsOn": [
...
],
"properties": {...},
"resources": [
{
"name": "MSDeploy",
"type": "extensions",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', variables('functionAppName'))]"
],
"tags": {
"displayName": "webDeploy"
},
"properties": {
"packageUri": "[concat(parameters('_artifactsLocation'), '/', parameters('webDeployPackageFolder'), '/', parameters('webDeployPackageFileName'), parameters('_artifactsLocationSasToken'))]",
"dbType": "None",
"connectionString": "",
"setParameters": {
"IIS Web Application Name": "[variables('functionAppName')]"
}
}
}
]
},
Make sure Azure Resource manager would be able to access the package!
Upvotes: 2