Azure Serverless - What is the best solution for my case?

Nouman Khan 21 Reputation points
2021-07-08T12:35:40.627+00:00

Hi All,

I am trying to build a workflow. It will be a 'button' on my website performing the following steps:

  1. Asks the user for AWS/Azure/GCP Access Key and Secret
  2. Spins a Linux container on the Cloud
  3. Ssh container
  4. Create a folder in Linux - 'Folder1'- copy the file from blob storage named 'pre-config.tf' in the folder
  5. Installs terraform
  6. Run command ' terraform init'
  7. Run command 'terraform plan'
  8. Run the command 'terraform apply'
  9. Once the infrastructure is successfully deployedConfirm the user/alert/email
  10. Destroy the infrastructure after 2 hours

What is the best way to implement the above scenario in Azure?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,936 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,558 questions
0 comments No comments
{count} votes

Accepted answer
  1. Samara Soucy - MSFT 5,141 Reputation points
    2021-07-12T23:32:18.57+00:00

    There are quite a few options, but based on tags I'm guessing you are looking at Functions and Logic Apps specifically, and that is what I would generally choose for something like this. The short answer is that Logic Apps doesn't currently support SSH for anything other than SFTP so you will need to use Functions or a combination of the two. In particular I'd take a look at the durable functions framework. This helps with chaining together tasks in a workflow and helps support restarting a workflow in the middle if it is interrupted. For example, if your SSH connection was interrupted between installing terraform and running commands, you could pick back up at the init step than you would otherwise.

    Sending email directly from Azure isn't permitted- you need to use a service like Sendgrid or Outlook. Sendgrid in particular is well-integrated into Functions, or you can use the service of your choice.

    The one small hiccup is the 2 hour wait between creating the container and destroying it. By default, Azure Functions consumption plan has a maximum run time of 10 minutes. There are two main options for overcoming this. The first would be to run your functions on a Premium plan which has an unlimited maximum run time- you set the value to whatever you want. The second option is to use scheduled messages in either a Service Bus or Storage queue. Your first set of functions would both output to email and schedule the message in the queue with any needed info. The next function would listen to the queue and pick up the message after the queue releases the message two hours later.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.