Can we send pipeline run id as hyperlink in email notifications from synapse?

Jakeer Shaik 106 Reputation points
2022-06-27T10:51:50.44+00:00

Hello,

We are sending synapse pipeline failure information in email notification using logic apps. however, is there way to pass the pipeline run id, pipeline name as hyperlinks, so that, user can re-directed to synapse pipeline when there is a failure based on the user permissions.

Thanks,
Jakeer. Shaik

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,358 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,518 questions
0 comments No comments
{count} votes

Accepted answer
  1. MartinJaffer-MSFT 26,021 Reputation points
    2022-06-28T17:04:37.387+00:00

    Hello @Jakeer Shaik ,
    Thanks for the question and using MS Q&A platform.

    As we understand the ask here is about putting pipeline name and links to pipeline run into an email.

    To get the pipeline name, we can use pipeline expression

    @{pipeline().Pipeline}  
    

    To get the pipeine run ID we can use pipeline expression

    @{pipeline().RunId}  
    

    However we need more than just the RunId to create a hyperlink. When I go to the Monitoring section and select a pipeline run to see details, the URL takes the form of:

    https://web.azuresynapse.net/en/monitoring/pipelineruns/{pipeline_run_id}?workspace=%2Fsubscriptions%2F{subscription_id}%2FresourceGroups%2F{resource_group_name}%2Fproviders%2FMicrosoft.Synapse%2Fworkspaces%2F{workspace_name}  
    

    Seeing this, we can build up a URL. The %2F is a URL-encoded form of slash /. Everything after the ?workspace= is describing the path to find the Synapse workspace. This isn't going to change, because the pipeline belongs to the workspace.

    @{concat(  
    'https://web.azuresynapse.net/en/monitoring/pipelineruns/',  
    pipeline().RunId,  
    '?workspace=%2Fsubscriptions%2Fmy_subscription_id%2FresourceGroups%2Fmy_resource_group%2Fproviders%2FMicrosoft.Synapse%2Fworkspaces%2Fmy_Synapse_workspace'  
    )}  
    

    Now there is the question of turning this into a hyperlink. Some email clients work different. When I paste a URL into outlook it turns into link automatically. Some others need to click a button. Some use HTML. For the HTML links take the form of:

    <a href="my_url">text to display</a>  
    

    We can also construct this with concat. For brevity, I put ... instead of that long path discussed above.

    @{concat(  
    '<a href="https://web.azuresynapse.net/en/monitoring/pipelineruns/',  
    pipeline().RunId,  
    '?workspace=%2F...',  
    '">',  
    pipeline().Pipeline,  
    '</a>'  
    )}  
    

    Please do let me if you have any queries.

    Thanks
    Martin


    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
      • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Jakeer Shaik 106 Reputation points
    2022-06-30T10:11:15.88+00:00

    Thanks Martin! This works perfect.

    However, is there a way to get the resource group name during the run time instead of hardcoding it.

    Thanks,
    Jakeer. Shaik


  2. Jakeer Shaik 106 Reputation points
    2022-07-01T10:24:48.04+00:00

    @MartinJaffer-MSFT , again thanks for the swift response.

    I do see that there is no global parameter option with synapse. And also, we are planning to do CI/CD deployment using Azure devops.

    Since I am new to DevOps, is it really possible to get that manual effort done as it is a automated process?

    One more thing, need you suggestion on the below

    Is it a good idea to keep the resource group name in key vault and read it in the pipeline and use it further?


  3. Jakeer Shaik 106 Reputation points
    2022-07-06T08:55:40.977+00:00

    Thanks Martin! It really helped.

    0 comments No comments