internal async Task <string> CreateRunPipeline(ManualTriggerRequest inputRequest)
        {
            // Authenticate and create a data factory management client
            DataFactoryManagementClient client = await GetDataFactoryManagementClient();

            return(await RunAdHocPipeline(client, inputRequest));
        }
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = "Trigger/Manual")] ManualTriggerRequest manualRequest,
            ILogger log)
        {
            if (manualRequest != null && manualRequest.IsValid)
            {
                try
                {
                    TriggerManager runner = new TriggerManager();
                    string         runId  = await runner.CreateRunPipeline(manualRequest);

                    if (!string.IsNullOrEmpty(runId))
                    {
                        return(new OkObjectResult(runId));
                    }
                }
                catch (Exception ex)
                {
                    return(new ObjectResult(ex.Message)
                    {
                        StatusCode = StatusCodes.Status500InternalServerError
                    });
                }
            }
            return(new StatusCodeResult(StatusCodes.Status400BadRequest));
        }
        private async Task <string> RunAdHocPipeline(DataFactoryManagementClient client, ManualTriggerRequest inputRequest)
        {
            AzureOperationResponse <CreateRunResponse> runResponse = await client.Pipelines.
                                                                     CreateRunWithHttpMessagesAsync(
                inputRequest.ResourceGroup,
                inputRequest.DataFactoryName,
                inputRequest.PipelineName,
                parameters : inputRequest.PipelineParams
                );

            return(runResponse.Body.RunId);
        }