practicalGuy
practicalGuy

Reputation: 1328

Trigger pipeline upon approval in Azure

I have a report which generate after running an ADF pipeline, and I would need to append these records into a history table upon client approval. So, I need to use either PowerBi or Sharepoint to show this report to the client and get approval. So, I have this plan, Can someone please tell me if this is doable, if yes, how to achieve it? if not please suggest changes.

  1. Show the report in either PowerBI or SharePoint, and have buttons Approve/Reject.
  2. If the client clicks on Approve, it should trigger a pipeline using the Logic app, with necessary parameters passed.

if this is doable, can you please share the references? if not, please let me know how i achieve this functionality in another way.

Upvotes: 1

Views: 479

Answers (1)

SwethaKandikonda
SwethaKandikonda

Reputation: 8234

One of the workaround to achieve your requirement is to use logic apps and send the PowerBI or SharePoint link using email with Send approval email action of outlook connector where the email is send with Approval or Reject user options.

enter image description here

The flow is kept on hold until the the response is received.

enter image description here

In my outlook

enter image description here

Run after response is received

enter image description here

Now to continue the flow if you receive accepted response, You can add condition action and check if the response is Approved and then continue the flow.

enter image description here

RESULTS:

enter image description here

Below is the codeview of my Logic App

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Condition": {
                "actions": {
                    "Compose": {
                        "inputs": "Your response have been Accepted.",
                        "runAfter": {},
                        "type": "Compose"
                    }
                },
                "expression": {
                    "and": [
                        {
                            "equals": [
                                "@body('Send_approval_email')?['SelectedOption']",
                                "Approve"
                            ]
                        }
                    ]
                },
                "runAfter": {
                    "Send_approval_email": [
                        "Succeeded"
                    ]
                },
                "type": "If"
            },
            "Send_approval_email": {
                "inputs": {
                    "body": {
                        "Message": {
                            "Body": "https://microsoftapc.sharepoint.com/teams/Sample2408/Lists/SampleList/AllItems.aspx",
                            "HideHTMLMessage": false,
                            "Importance": "Normal",
                            "Options": "Approve, Reject",
                            "ShowHTMLConfirmationDialog": false,
                            "Subject": "Approval Request",
                            "To": "<Email_ID>"
                        },
                        "NotificationUrl": "@{listCallbackUrl()}"
                    },
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['office365']['connectionId']"
                        }
                    },
                    "path": "/approvalmail/$subscriptions"
                },
                "runAfter": {},
                "type": "ApiConnectionWebhook"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "parameters": {
            "$connections": {
                "defaultValue": {},
                "type": "Object"
            }
        },
        "triggers": {
            "manual": {
                "inputs": {
                    "schema": {}
                },
                "kind": "Http",
                "type": "Request"
            }
        }
    },
    "parameters": {
        "$connections": {
            "value": {
                "office365": {
                    "connectionId": "/subscriptions/<Sub_Id>/resourceGroups/<RG>/providers/Microsoft.Web/connections/office365",
                    "connectionName": "office365",
                    "id": "/subscriptions/<Sub_Id>/providers/Microsoft.Web/locations/centralus/managedApis/office365"
                }
            }
        }
    }
}

Upvotes: 1

Related Questions