Setting up email Notification on Azure DevOps - azure-devops

I have Self-hosted agents on my Azure DevOps on which the execution is scheduled from ADO every night using the release pipelines which i've created. I would want to send out email notification with the results to a Distribution List after the completion of the execution. How can i achieve this??
I want this summary page to be sent as an attachment -

Setting up email Notification on Azure DevOps
AFAIK, Azure devops does not support add attachment in email Notification directly.
As workaround, we could use a powershell script to get test results with REST API then send emails:
To get test results with RESI API Releases - Get Task Log:
GET https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/releases/{releaseId}/environments/{environmentId}/deployPhases/{releaseDeployPhaseId}/tasks/{taskId}/logs?api-version=5.0-preview.2
Then use powershell scripts to read the details of the test result file (.trx) and create a formatted email message to sent to the defined recipients:
You could check this thread Send Test Result Email After Running Automated Tests with Release Management for some details.
Hope this helps.

Related

Azure DevOps. Get Discord Notification on Specific Pipeline Failure

We have a few pipelines that are taking backups on schedule. We would like to receive notifications on Discord in case if specific Pipelines were to fail.
There is a way to receive an email notification and an official application to integrate Slack into Azure DevOps.
But is there a good way to do that for Discord?
You can use the Discord Webhook extension that give you a task to send messages to Discord during your pipeline.
When creating a webhook for a channel in a Discord server, you will be given a url which contains the Channel ID and the Secret Key for that webhook in this format: https://discordapp.com/api/webhooks/{channelId}/{webhookKey}.
You will not need to provide the url to the task, but rather just the Channel ID and Secret Key. (The first section in the link above, Making a Webhook, is all that needs to be followed to be able to use this task).
More info you can find here.
After you know which values put in the task you can dd it to your pipeline and configure it to run only if the pipeline failed with the condition failed().

How to use job monitor to check whether emails have been sent by Azure DevOps

I'm facing the issue that I can't get email notification from Azure DevOps.
I have read this question and learnt that there is a job monitor that can check whether Azure DevOps has sent the emails.
If I go into the job monitor I can see that the email notification job was partially successful...
I want to know how could I get the job monitor and how to use it.
By the way, I have done some checkings following this document but the issue still exists.
I want to know how could I get the job monitor and how to use it.
The job monitor is a monitoring dashboard dedicated to TFS. If you are using the azure devops service, I am afraid you cannot use the job monitor. As far as I know, it is impossible to check whether the email is sent in the azure devops service. Please refer to this blog.
You can first go to your personal subscriptions and locate the subscription, which you feel should have produced an email and ensure it's enabled.

How we can attach a file in Azure DevOps email job status noifications

I have few pipelines in Azure DevOps and some jobs are generating few files during build process. I want to send a mail to all team members with the same file as an attachment.
I'm using Azure Email report extension to send mails.
Can someone please help me how can I attach the file to mail notification to all team members.
We cannot attach a file in the email notification, as a workaround, we could install the extension Send Email to send email and add the attachment.
In the end of your pipeline definition -> Add a task Send email-> configure required options.
To delivery the artifact files by the Send Email task, you can select the Add Attachment option and specify absolute path for the attachment:
Update1
We could also refer to this doc to use email task to send email with the attachment.
Note: We could not send email for a azure DevOps team group via these task, you could also submit your user voice on this website

How do I automatically trigger email notification with custom message after deployment (in CD pipeline) in VSTS

I have a CD pipeline with Azure Deploy task and I want to trigger a email notification to developers after successful deployment but with custom message. I researched on 'Send Email' task but it requires an SMTP server (say google SMTP). is there a feature within VSTS to trigger a mail?
You could use the SendGrid Email extension. You would need a SendGrip API key (hence a SendGrid account) but you can create one for free on Azure.
It would be limited to 25000 emails per month, but it should be enough. And if it isn't, you can upgrade your plan in no time
I Hope I helped you :)
It seems you are using the Send Email task developed by DutchWorkz B.V..
You can use the Send Email task developed by Rene van Osnabrugge (Xpirit) which just need to specify the email addressed, subject and email body.

Need the mail to be triggered upon success or failure of Build or release definition in VSTS

I have a requirement like whenever my build or release definition fails in VSTS it should trigger mails to all the team members including the error part.How can it possible? Please share your thoughts on this.As I don't see any information available from Google.if build fails, mail with subject "build failed" and body containing which step in definition failed and its explanation,stylecop errors,
Code analysis error,
test fails,
codecoverage results,
or simply build error.
Please suggest me.
VSTS has a build-in feature (Notifications) of sending email to corresponding users when build complete or fail, but you can’t custom the email body.
You need to use a power-shell script to get status of all the tasks in build definition. This script query the status from Apis available in VSTS.
And then use the result to prepare a custom email body and sending out this mail through a third party email sender.
There is the sample of build result: build-results-enhancer . For how to send email in a build/release pipeline you could take a look at this blog: Sending Email Notification from VSTS/TFS Build