The most common question, I generally see in every forum is how to use source control for Azure functions which are developed using azure portal.
We currently have support for source control for Azure functions developed using Visual Studio 2017 which is similar to having source control for any common .Net Applications.
When a function is developed using the azure portal, there is no direct way to integrate and deploy changes from source control to azure functions runtime. We can achieve source control for functions developed using portal with some hacks.
Every azure function app running in azure platform requires a storage account to store the artifacts corresponding to a function. Below are the steps which I would use to solve the source control issue.
- Following the regular steps of a function creation, I created a function HttpTriggerCSharp2 in the portal. Note the storage account which is configured while creating a function app.
- Navigate to the storage account which just created in the previous step and select Files in the overview window.
3. Select the Files Service name displayed . Navigate to site/wwwroot
4. This would display all the functions available in the function app.
5. On navigating to HttpTriggerCSharp2 folder , it would display the run.csx file which is used in the portal to define the function.
I would use below options to move my changed code from source control to azure file share. The key here is to note the file reference urls and use those in your scripts or application.
a. Now we can write a custom powershell script to upload the file to azure using azure file storage API .
b. Write a custom application or tool to read the file from source control and push the change to azure using REST API.
Below url provides reference on File Service REST API.
With this thought my next article will be focusing on any one approach (a or b) and shall share my experiences.