Run Azure Runbooks with a Bot in Microsoft Teams or Skype

While working on a customer scenario where Azure Automation Runbooks needed to be started as easy as possible by less technical people I suggested to use Bots. And it turned out to be very easy to get started. No deep technical knowledge is needed to get started Smile So what do you need to do to get started?

Pre-requisites:

Microsoft Bot Framework

Before I get into the details first some background information about Bots and the Microsoft Bot Framework. A bot is a web service that interacts with users in a conversational format. Users start conversations with your bot from any channel that you’ve configured your bot to work on (for example, Text/SMS, Skype, Slack, Facebook Messenger, Microsoft Teams, and other popular services).

The Microsoft Bot Framework is a comprehensive offering that you use to build and deploy high quality bots for your users to enjoy wherever they are talking.

AzureBot

The AzureBot was created to improve the productivity of any developer, admin, or team working with Azure. You can interact with resources in your own Azure subscriptions via natural language on the Microsoft Teams, Skype, and Slack messaging channels. The current implementation enables users to authenticate to the Azure subscriptions a user has access to, select and switch subscriptions, start and stop RM-based virtual machines, and list and start Azure Automation runbooks.

How does the solution works?

You can start using AzureBot by going to the AzureBot in the Bot Framework webpage directory. You first need to add the AzureBot to one or more of your conversation channels.

image

After adding the AzureBot to Microsoft Teams or Skype you can start talking to the AzureBot.

image

First we need to login to be able to interact with the AzureBot. After typing login, your browser is opened and you need to type a code into the Skype or Microsoft Teams chat window.

Remark: Don’t copy and paste the code. Just type the code.

Next step is to select your Azure Subscription if you have multiple Azure Subscriptions.

image

Let we first start with listing my Azure Runbooks, but now in Microsoft Teams. Type list runbooks.

image

For testing purposes I created a very simple HelloWorld Runbook.

Code:

 param($firstname,$lastname)

Write-Output "Hello $firstname $lastname"

 

image

If we run this in a Runbook we get the following output. Make sure you publish the runbook before you can call the runbook with the AzureBot.

image

To start the runbook type “run runbook stsHelloWorldPS

image

Confirm you want to run runbook and enter the parameters of the Runbook

image

And wait for the runbook to finish.

image

Finally retrieve the result of the runbook by typing show job3 output.

image

Hope this shows how easy it is to interact with Azure Resources in Azure using the AzureBot.