1

I have an external application which I want to launch and wait for a response from using an azure function, i.e. allowing me to execute it from PowerApps and Microsoft Logic.

I cobbled together some C# code (below - it is probably wrong) which should execute the process with the params supplied and report the STDOUT.

namespace FunctionApp1
{
    public static class Function1
    {
        [FunctionName("GetInfos")]
        public static void Run(string param, ILogger log){
            var process = System.Diagnostics.Process.Start("Obscure_Application.exe", param);
            var output = process.StandardOutput.ReadToEnd();
            process.WaitForExit();
            log.LogInformation(output);
        }
    }
}

I realize that if this application were to run it would have to:

  1. Be running on a machine with Windows OS.
  2. Have the application installed.

As far as I understand the Azure Function hosts the runtime. How do you therefore:

  1. Ensure it is running on the correct OS?
  2. Ensure it has the correct applications installed?

Edit:

This is different from Run EXE in Azure Functions, because a specific requirement is that the software is installed. The solution given in that question is strictly regarding self-contained exe files. If software is supplied as an installable msi, the above solution will not work.

9
  • 1
    I assume that you know that you won't be able to use the Azure-hosted Functions, correct? You can, however, do all this when hosting the Functions yourself. For example in a container Commented Dec 2, 2019 at 14:01
  • @silent I didn't know that at all no! Is that so? I mean, it would make sense to me if that were the case, but I didn't know that at all. I had hoped the hosted functions could accommodate for this. But thanks that is very helpful to know. Commented Dec 2, 2019 at 14:03
  • Does this answer your question? Run .exe executable file in Azure Function Commented Dec 2, 2019 at 14:06
  • If your application is a simple, self-contained .exe, then this might still be feasible. Similar to what @MurrayFoxcroft pointed out: learn.microsoft.com/en-us/samples/azure-samples/… Commented Dec 2, 2019 at 14:11
  • 1
    yeah you could do that, or perhaps simplify it by wrapping it in a container and then deploying to a container service. But certainly, using something like Functions will never work - the whole point of them is that they're a "serverless" environment, where you don't have to know or care about the underlying server environments. The tradeoff of that is that you don't have any access or control over the server either, so you can only do what is permitted by the service provider. Commented Dec 2, 2019 at 14:19

1 Answer 1

3

As discussed in the comments:

When the requirement is to actually install software (.msi etc.), you cannot use the the Azure-hosted version of Azure Functions since you do not have that kind of control over the environment there.

If you would still like to use Azure Functions, you can though: By hosting the Functions runtime in a container and add your applications to it as well. In this case, the Function code can access anything on the host just as any other application code could.

There was also a non-container based version of self-hosted Functions but it looks like that preview is not updated anymore.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.