I have written powershell scripts in Azure runbooks in Azure Automation. It’s not a new concept. It’s even from back in 2014
I started to use it because there is no SQL Agent in Azure SQL databases. I relied on SQL Agent to perform Ola’s database maintenance scripts. I use the Azure automation with Runbooks now for a long time to build reports from Azure SQL and have them send to people by SMTP.
The problem is that I string concatenate HTML in the powershell script and just put the results in an HTML enabled Email message. It is still a good option… Until a coworker requests an Excel attached to the mail…
Excel in Azure Runbook (Powershell)
I did build the powershell locally first.
When using the Azure Automation ISE add-on for Windows PowerShell ISE it hit me. The cloud probably has no Excel com/interop…
But I realised that I could also just use Azure Functions and code in C# and have a time trigger. This enables me to write my beloved C# rather then scripting Powershell. I can also just use the Epplus nuget package.
The Azure functions v2 are now in preview and have .Net Standard support (which is great!)
@AzureSupport @VisualStudio @AzureFunctions What magic schedule should I enter if I want it to run the 1st day (or last minutes) of a month each month? There is no explanation of the default value and no ref to docs for custom. Perhaps add a link to https://t.co/e0hY2Isxyn there? pic.twitter.com/kCpFAqXmfi— JP Hellemons (@JPHellemons) July 19, 2018
The Visual Studio dialog can be unclear if you visit it for the first time and have no clue that the schedule uses CRON notation. Maybe they will change it, but now you know.