Search code examples
azureazure-data-factoryazure-vm

How to run a powershell command using Azure Data Factory web Activity


I am attempting to run a PowerShell command that creates a BACPAC backup of a database in an Azure VM, does anyone know how to pass the command to the VM through a web activity? enter image description here

The connection is fine but how do I pass the script itself?


Solution

  • Web activity doesn't run PowerShell Script.

    Web Activity can be used to call a custom REST endpoint from an Azure Data Factory or Synapse pipeline. You can pass datasets and linked services to be consumed and accessed by the activity.

    Custom activity is the only activity which can execute Powershell scripting. But as you mentioned that you are not interested in Azure Batch solutions.

    So, you can go with Azure Function and run that function using Azure Function activity in the Azure Data Factory.

    You can refer this third-party tutorial - Running Powershell in Azure Functions - to deploy a Azure Function and use Azure Function activity in ADF to run the Function in ADF.