Thought on Source Control for Azure Functions

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.

  1. 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.
  2. Navigate to the storage account which just created in the previous step and select Files in the overview window.

FileService3

3. Select the Files Service name displayed . Navigate to site/wwwrootFileService1

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.

FileService2

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.

https://docs.microsoft.com/en-us/rest/api/storageservices/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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s