UPDATE JUNE 2023:
Please note the Azure Pirate project has been closed.
For more information, please see here.
One of the best parts about working with Azure is the community. I frequently consume and rely on content put forward by the Azure community, particularly by those on Twitter. Back in September, I decided it was about time I gave something back!
Primarily, the community content I consume is from people’s blog posts and YouTube channels. I’d make a point of using a tool such as Feedly to capture and display the blog posts via their RSS feeds, but had mixed results getting YouTube channels working properly. It was getting a bit much to keep on top of all the updates from so many different sources, so I decided to automate something.
This is where the idea came from! Compile a great big list of Azure community blog and YouTube RSS feeds and share it with the community, so others can make use of it. So that’s what I did.
I then decided to take it one step further. It occurred to me that I could help market the community content by creating a Twitter bot that would tweet about a new blog post or YouTube video as and when it arrived. So, that’s what I did!
Me being me, I stuck to what I know best and came up with a cloud-native serverless Azure design.
Here’s what I ended up with:
The first Function App runs every hour on a timer trigger. It parses a .csv containing all the RSS feeds and checks for new posts within the past hour. The .csv file is in an open GitHub repo, so that it can easily be added to or amended via a pull request. Check it out here.
For any new posts found, the post URL and metadata are extracted. The URL is passed to a second Function App hosting a URL shortening service, returning a shortened URL under a custom domain (
url.azurepirate.com/***). Note - the URL shortening is a fork of AzUrlShortener by Frank Boucher.
The contents of the Tweet is formed via a pirate phrase generator I wrote and is then saved as a message to an Azure Service Bus Queue. A record of the post and its metadata are saved to Cosmos DB (as the first Function does a lookup against Cosmos DB to prevent duplicates being sent out).
The third Function App runs per a schedule to prevent spamming Twitter with multiple tweets all at once. It pulls one message from the queue per execution and uses the Twitter APIs to send out the Tweet.
Recent changes have introduced an Azure Key Vault to store and centralise secrets, such as connection strings.
All the code is written in PowerShell, and the repo is open to the public. Check it out here.
Here’s an example of what a blog post update looks like:
I've set it to tag the author's Twitter handle and include some community tags (to hopefully increase reach).
The YouTube tweets were straightforward enough at first. Good old John Lunn @jonnychipz (whom by the way has been an avid supporter of this project) suggested I embed a thumbnail of the YouTube video into the tweet, which was a neat idea. This took some doing, but I got it working in the end.
Here’s what that looks like:
This project is by no means perfect, and I'm happy to collaborate with anyone that's interested.
I have plans to branch out into Mastodon and to spin up a website off the back of it. After all, I have all the data saved in Cosmos DB, so I could display it on in a web format in addition to all the Tweets. From there, I can automate the user submissions. At the moment, adding new feeds to the list is a manual process or in the form of pull requests.
If you’d like to get involved, you are more than welcome to! Equally, if you’d like to have your blog or YouTube channel included, please get in touch.
Thanks for reading - ye Scallywag!!