The first step is to create an Azure Automation Account in your Azure subscription.
1. On the Microsoft Azure Home Page click on Create a resource
Search for Automation and click Create.
Select your correct information and give a name (based on your naming convention) to the Automation Account as shown in the example below.
After the deployment, click on Go to resource.
2. Add the Teams PowrShell Module
Now that we have an Azure Automation Account, we need to add the Teams PowerShell module that we will use in our Runbook.
On the Automation Account you just created, under Shared Resources click on Modules.
We need the Teams PowerShell module, which is not included by default.
To access the Module Gallery, click on Browse gallery as shown below.
Simply type "teams" into the search field, and the MicrosoftTeams PowerShell module will appear. Click on it.
Once you open the MicrosoftTeams PowerShell module, click on Select.
Choose the 5.1 Runtime version and click Import.
The module can take a few minutes to be imported.