I have a production and a development environment in azure data factory. I have developed the pipeline such that when the pipeline fails, we get an email notification. However the issue is if someone tests a pipeline in development and it fails we still get error email and this is bugging a lot of people as no one wants to see email of someone else's error run.
Is there a way to implement the pipeline in such a way that, if a pipeline fails in production everyone should receive an email but if a pipeline fails in development, only the developer should get the email? I cannot seem to find any system assigned variable or something like User().email just like we have in powerapps.
Please see: We cannot have a parameter in pipeline like email: <>. I need a way to get email id of the person using the pipeline dynamically.
CodePudding user response:
You can invoke a REST API to activity logs and get the event initiated by - which has user information of who triggered the pipeline.
Sample Request
https://management.azure.com/subscriptions/<SUBSCRIPTION>/providers/Microsoft.Insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp ge '<CurrenTime - 5 mins>' and eventTimestamp le '<CURRENT TIME 5 mins>' and resourceUri eq /subscriptions/<SUBSCRIPTION>/resourceGroups/<RESOURCEGROUP>/providers/Microsoft.DataFactory/factories/<DATAFACTORYNAME>'
Refer this link for more information