6

I have a project hosted in Github that is being continuously deployed to Azure whenever a developer checks in any code. (this deployment is for a dev server, not prod).

In the case of a failed deployment, how can I get the failure log emailed to me automatically? This does not seem to be a current feature in Azure.

For the deployment, we are using a Kudu deploy.cmd file generated with the

azure site deploymentscript

command. In this script there are several tests for errors after the commands finish. Such as:

IF !ERRORLEVEL! NEQ 0 goto error

with the error label executing these commands:

:error
endlocal
echo An error has occurred during web site deployment.
call :exitSetErrorLevel
call :exitFromFunction 2>nul

It seems to me that this would be an ideal place to have the log file emailed to me. But I am not sure what that would look like. Any help or pointers in the right direction would be great.

7

Apparently Kudu has a web interface I was previously unaware of. If you browse to:

https://{mysitename}.scm.azurewebsites.net

you get dropped into Kudu's admin site. From here you can do a lot of things. One of them being browsing through a list of plugins that people have written for Kudu!

Sadly, none of them seemingly will send you an email on a failed deployment.

However, one of the other things you can do is wire up "webhooks". This is a callback url where Kudu will notify after any deployment.

So the long answer to the question is: create another website that will listen for these notifications from Kudu. Have the code of that website use the Kudu API to get the deployment log file if there is a failure. Have the code of the website then email that log file.

Seems like a lot of steps, but there is no reason it won't work.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.