How to run a powershell script on a Azure VM using Logic app

Pratibha . (SC-ALT) 1 Reputation point
2022-01-17T07:00:05.453+00:00

Hi Team,

I have a requirement where we need to run a Powershell script sitting on an azure VM, and the input or Parameter to pass that to PS would be provided from Logicapp step.
That PS runs Azure Active Directory commands so its a requirement to run that PS from a domain joined VM. this is the reason we can not use Azure functions.

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,933 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,601 Reputation points Microsoft Employee
    2022-01-17T10:03:29.987+00:00

    @Pratibha . (SC-ALT) There is a similar scenario documented by using Azure Functions and PowerShell Remoting. While this doc refers to using Hybrid Connection since the VM is on-premises, in your case you could directly connect to the VM if it is exposed to the internet. In the code shown in this section of the doc, you would just have to update the $Script variable to your requirement.

    Finally, you could just call this Azure Function from your Logic App.

    0 comments No comments