Cannot call Invoke-AzDataFactoryV2Pipeline with PSPipeline object as only parameter

Olov Günther-Hanssen 1 Reputation point
2021-01-11T13:42:50.193+00:00

I have a script in Powershell where I want to invoke an Azure DataFactory pipeline, and I would like to do it by simply providing a pipeline object (PSPipeline), as it is detailed in the documentation:

Invoke-AzDataFactoryV2Pipeline
[-InputObject] <PSPipeline>
[[-Parameter] <Hashtable>]
[[-ReferencePipelineRunId] <String>]
[-IsRecovery]
[[-StartActivityName] <String>]
[-StartFromFailure]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]

(taken from here: https://learn.microsoft.com/en-us/powershell/module/az.datafactory/invoke-azdatafactoryv2pipeline?view=azps-5.3.0)

I get the pipeline object from the command Get-AzDataFactoryV2Pipeline. The code looks like this:

$pipeline = Get-AzDataFactoryV2Pipeline -DataFactory $dataFactory -Name $pipelineName  
$runId = Invoke-AzDataFactoryV2Pipeline $pipeline  

and I get this error:

Invoke-AzDataFactoryV2Pipeline: Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided.

I think this error is weird, because from the documentation, it states that only 1 parameter is mandatory, and that is the PSPipeline object, if you provide that of course. I have checked the output from Get-AzDataFactoryV2Pipeline, and that seems ok. The output from $pipeline.getType() is

IsPublic IsSerial Name                                     BaseType  
-------- -------- ----                                     --------  
True     False    PSPipeline                               Microsoft.Azure.Commands.DataFactoryV2.Models.AdfSubResource  

Am I doing something wrong here, or is the documentation not accurate in this case?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,992 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,576 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Saurabh Sharma 23,821 Reputation points Microsoft Employee
    2021-01-22T23:40:31.283+00:00

    @Olov Günther-Hanssen Sorry for delay. This has been identified as a bug which is causing the command to look for either -Parameter or -ParameterFile as an additional input to this command when using -InputObject. Product team has created an internal work item to fix this issue however provided the below workarounds to invoke the pipeline if you are using -InputObject :

    1. Invoke the pipeline with dummy parameters even if the pipeline doesn't use parameters as shown below :
      $runId = Invoke-AzDataFactoryV2Pipeline $pipeline *-Parameter @{ Number = 1 }* 59741-image.png
    2. Use the pipeline object to populate datafactory, resourcegroup and pipeline names
      $runId = Invoke-AzDataFactoryV2Pipeline -DataFactoryName $pipeline.DataFactoryName -ResourceGroupName $pipeline.ResourceGroupName -PipelineName $pipeline.Name

    59732-image.png

    Thanks for reporting this.
    Please let me know if you have any questions.


    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.


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.