Deploying Azure Function & Logic App

Deploying Azure Function & Logic App

ยท

4 min read

Task Requirements :

  • Create and deploy an Azure Function that performs a specific task (e.g file processing) and documents the process.

  • Provision an Azure Logic App that performs a specific task and documents the use case.

  • Implement infrastructures for both serverless applications using Terraform.

Execution :


Create Terraform Files & Define Each Resource Block

Create an Azure Function

  • Once your Function App is created, go to its dashboard in the Azure Portal.

  • In the left sidebar, click on "Functions" under the "Functions" section.

  • Click the "+ New function" button to create a new function. You can choose a template that suits your file processing needs examples are http trigger, service bus trigger, blob trigger. In my case, I used a time trigger.

  • Configure function, the template of the cron-jobs is to run a backup for certain file extensions in a blob storage once it is 12 AM daily, also configured the function app to use a python runtime stack.

  • Typically, you'll use Azure Blob Storage bindings for file processing. Configure the bindings and timer by editing the function.json file. Sample of the file can be found at this link ----> https://github.com/mightygull/Knixat_PG/blob/main/Functions%20Folder/File%20Processing%20Time%20Trigger/function.json

Develop the File Processing Logic

Deploy the Azure Function

  • Click on the Azure Tool Extension on the Visual Studio Code and navigate to the workspace section.

  • Click on the Azure Function Icon to deploy the function in your workspace in your preferred resource group.


Automating Slack Notifications for GitHub Pull Requests with Azure Logic App

Create an Azure Logic App :

  • The Logic App has already been configured to use the appropriate subscription and resource group in the terraform file.

Define a Trigger :

  • Add a trigger to start the workflow. In this case, select the "When a pull request is created" trigger from GitHub.

Connect GitHub :

  • Sign in to your GitHub account and configure the Logic App to connect to your GitHub repository.

  • Select the specific repository and set the trigger to activate when a new pull request is created.

Add a Condition :

  • You can add a condition to filter pull requests based on specific criteria, such as the branch name, labels, or author, to determine whether you want to send a Slack notification.

Connect to Slack :

  • Add a step to send a message to Slack.

  • Configure the Slack action to connect to your Slack workspace.

  • Select the target channel or user where you want to send the message.

Create a Notification Message :

  • In the Slack message action, define the content of the message. You can use dynamic content from the GitHub trigger to include information about the pull request, title, author, or a link to the pull request.

Save and Enable the Logic App :

  • Save your Logic App and enable it. It will now listen for new pull requests in the specified GitHub repository.

A sample of the logic app code template can be found at this link ----> https://github.com/mightygull/Knixat_PG/blob/main/Logic_App%20Folder/logicapp.json


Screenshot Of The Logic App Work Template

Screenshot Of The Slack Notifications Created

ย