I Wrote An App – Azure Status Alerts
While studying for the 70-533 Implementing Microsoft Azure Infrastructure Solutions exam (of which I passed!), I found it very easy to get distracted. The major distraction was my attempt to write a very basic .NET Azure Web App.
https://azurestatusalerts.azurewebsites.net/
My app is a very simple one. It has three functions:
1. Manage Subscribers
I’m using an Azure Web App to host the .NET application. It’s a very (very) simple MVC application using scaffolding and a single controller. The controller is handling the subscribe, unsubscribe and resubscribe functions.
The form submits the subscribers email address into an Azure SQL Database.
2. Read Azure Status Updates
Because I’m not a developer, I didn’t want to go too hard-core down the .NET rabbit hole. All I needed was a way to read the Azure Status Updates and insert the data into the Azure SQL database.
I went with what I know, PowerShell.
I wrote a very simple PowerShell script, that consumes the https://azure.microsoft.com/en-us/status/ RSS feed.
Then I uploaded the script and created an Azure Webjob. Webjobs are run on a schedule (or continuously, or on-demand) and can execute a bunch of different code – bash, php, .cmd and of course PowerShell. The Webjob pulls in the information from the RSS feed, compares it with what has already been sent (to ensure no duplicates) and inserts the status into my SQL database.
3. Email Subscribers
Once the data has been pulled from the RSS feed and inserted into my database, I then use another PowerShell Webjob to send the status alert to the subscribers list. The script uses the Send-MailMessage cmdlet, and sends the email via an Office 365 subscription I have.
The resulting email includes the status alerts title, it’s published time/date and the content of the status alert
So there it is, a very (very) simple Azure Web App written by a ConfigMgr engineer with very little development experience. If I can write something like this, jump into your MSDN subscription and use your free Azure compute hours to have a crack yourself!
Matt
Comments
- Anonymous
November 23, 2015
Can you share the code?
I want to work with the feeddata but since there is not incident right now I cannot review the schema.
Thanks, Seb - Anonymous
November 25, 2015
Hey Seb. Yes, I had the same problem... waited a long time for an active alert to be raised!
Here's the attributes I'm using for my mail
$feedURL = 'http://azure.microsoft.com/en-us/status/feed/'
$rssFeed = [xml](New-Object System.Net.WebClient).DownloadString($feedURL)
$statusTitle = $status.rss.channel.item.title
$statusDescription = $status.rss.channel.item.description
$statusPubDate = $status.rss.channel.item.pubDate - Anonymous
February 29, 2016
Hi Matt,Can you share the code? Specifically how you are comparing RSS with what has already been sent and inserting into SQL database.ThanksAdam