|
| 1 | +--- |
| 2 | +title: Trigger the run of an ML pipeline from a Logic App |
| 3 | +titleSuffix: Azure Machine Learning |
| 4 | +description: Learn how to trigger the run of an ML pipeline by using Azure Logic Apps. |
| 5 | +services: machine-learning |
| 6 | +author: sanpil |
| 7 | +ms.author: sanpil |
| 8 | +ms.service: machine-learning |
| 9 | +ms.subservice: core |
| 10 | +ms.workload: data-services |
| 11 | +ms.topic: conceptual |
| 12 | +ms.date: 02/07/2020 |
| 13 | + |
| 14 | +--- |
| 15 | +# Trigger a run of a Machine Learning pipeline from a Logic App |
| 16 | + |
| 17 | +Trigger the run of your Azure Machine Learning Pipeline when new data appears. For example, you may want to trigger the pipeline to train a new model when new data appears in the blob storage account. Set up the trigger with [Azure Logic Apps](../logic-apps/logic-apps-overview.md). |
| 18 | + |
| 19 | +## Prerequisites |
| 20 | + |
| 21 | +* An Azure Machine Learning workspace. For more information, see [Create an Azure Machine Learning workspace](how-to-manage-workspace.md). |
| 22 | + |
| 23 | +* The REST endpoint for a published Machine Learning pipeline. [Create and publish your pipeline](how-to-create-your-first-pipeline.md). Then find the REST endpoint of your PublishedPipeline by using the pipeline ID: |
| 24 | + |
| 25 | + ``` |
| 26 | + # You can find the pipeline ID in Azure Machine Learning studio |
| 27 | + |
| 28 | + published_pipeline = PublishedPipeline.get(ws, id="<pipeline-id-here>") |
| 29 | + published_pipeline.endpoint |
| 30 | + ``` |
| 31 | +* [Azure blob storage](../storage/blobs/storage-blobs-overview.md) to store your data. |
| 32 | +* [A datastore](how-to-access-data.md) in your workspace that contains the details of your blob storage account. |
| 33 | +
|
| 34 | +## Create a Logic App |
| 35 | +
|
| 36 | +Now create an [Azure Logic App](../logic-apps/logic-apps-overview.md) instance. If you wish, [use an integration service environment (ISE)](../logic-apps/connect-virtual-network-vnet-isolated-environment.md) and [set up a customer-managed key](../logic-apps/customer-managed-keys-integration-service-environment.md) for use by your Logic App. |
| 37 | +
|
| 38 | +Once your Logic App has been provisioned, use these steps to configure a trigger for your pipeline: |
| 39 | +
|
| 40 | +1. [Create a system-assigned managed identity](../logic-apps/create-managed-service-identity.md) to give the app access to your Azure Machine Learning Workspace. |
| 41 | +
|
| 42 | +1. Navigate to the Logic App Designer view and select the Blank Logic App template. |
| 43 | + > [!div class="mx-imgBorder"] |
| 44 | + >  |
| 45 | +
|
| 46 | +1. In the Designer, search for **blob**. Select the **When a blob is added or modified (properties only)** trigger and add this trigger to your Logic App. |
| 47 | + > [!div class="mx-imgBorder"] |
| 48 | + >  |
| 49 | +
|
| 50 | +1. Fill in the connection info for the Blob storage account you wish to monitor for blob additions or modifications. Select the Container to monitor. |
| 51 | + |
| 52 | + Choose the **Interval** and **Frequency** to poll for updates that work for you. |
| 53 | +
|
| 54 | + > [!NOTE] |
| 55 | + > This trigger will monitor the selected Container but will not monitor subfolders. |
| 56 | +
|
| 57 | +1. Add an HTTP action that will run when a new or modified blob is detected. Select **+ New Step**, then search for and select the HTTP action. |
| 58 | +
|
| 59 | + > [!div class="mx-imgBorder"] |
| 60 | + >  |
| 61 | +
|
| 62 | + Use the following settings to configure your action: |
| 63 | +
|
| 64 | + | Setting | Value | |
| 65 | + |---|---| |
| 66 | + | HTTP action | POST | |
| 67 | + | URI |the endpoint to the published pipeline that you found as a [Prerequisite](#prerequisites) | |
| 68 | + | Authentication mode | Managed Identity | |
| 69 | +
|
| 70 | +1. Set up your schedule to set the value of any [DataPath PipelineParameters](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-showcasing-datapath-and-pipelineparameter.ipynb) you may have: |
| 71 | +
|
| 72 | + ```json |
| 73 | + "DataPathAssignments": { |
| 74 | + "input_datapath": { |
| 75 | + "DataStoreName": "<datastore-name>", |
| 76 | + "RelativePath": "@triggerBody()?['Name']" |
| 77 | + } |
| 78 | + }, |
| 79 | + "ExperimentName": "MyRestPipeline", |
| 80 | + "ParameterAssignments": { |
| 81 | + "input_string": "sample_string3" |
| 82 | + }, |
| 83 | + ``` |
| 84 | +
|
| 85 | + Use the `DataStoreName` you added to your workspace as a [Prerequisite](#prerequisites). |
| 86 | + |
| 87 | + > [!div class="mx-imgBorder"] |
| 88 | + >  |
| 89 | +
|
| 90 | +1. Select **Save** and your schedule is now ready. |
0 commit comments