Azure Automation using Azure AD SPNs

This is similar to my other blog post I did recently on sequentially starting and stopping virtual machines where I demonstrated setting up Azure automation using a normal user account in Azure AD as the credential.

There is also another blog post I did about setting up SPNs (Service Principal Names) in Azure AD – similar to service accounts.

So this blog post merges both Azure Automation and SPNs for credentials together.

The difference being, you just need to add an additional Azure Automation Variable for the Azure Tenant ID. You’ll will need to set yourself up an SPN first using my script, then go ahead and setup an Azure Automation account as per this post.

The Tenant ID Variable can be added as per the screenshots below.


Then added to the script as per….


The two scripts are listed below….

Start-Up Script:

Shutdown Script: