demiurgo86
demiurgo86

Reputation: 37

ADF - Pipeline with powershell script

I have written a small Powershell script in order to retrieve some information from my organization and export this into a .csv file:

Get-ADUser -Filter {company -Like "*COMPANYNAME*"} -Properties department | Select sAMAccountName, department, userprincipalname | export-csv -path C:\temp\test.csv

My aim is to create a pipeline in Azure Data Factory, in order to launch this script and export the csv into a dataset, so that I can get all the data within SQL Azure.

How could I create the pipeline and insert this script?

Upvotes: 0

Views: 4708

Answers (2)

Ed_Ru
Ed_Ru

Reputation: 134

You can run a PowerShell script by creating a DataFactory with a Custom Activity that runs the command: powershell .\script.ps1 You must copy script.ps1 in the StorageAccount linked with your custom activity.

To copy Activity Output you can follow this thread https://social.msdn.microsoft.com/Forums/en-US/5ceda984-874e-417b-8a28-7a512ede61d0/custom-activity-output-values-for-use-in-sequential-task?forum=AzureDataFactory, it worked for me. And find some extra info here: Copy output data from Custom Activity Powershell script

Upvotes: 3

Jay Gong
Jay Gong

Reputation: 23792

Based on this feedback, Powershell Script can't be run directly in the adf pipeline so far. Maybe you could vote up this thread.

You could configure custom activity from this document to run your ps script, also you could follow this github tutorial to create c# custom activity.

Upvotes: 1

Related Questions