How can repetitive tasks be easily automated using APIs and Azure?
MS Teams is a great tool to work and collaborate. For instance, when a new project comes up, just a few clicks are enough to create a new channel and invite all the people involved. The best of it? You can add both internal and external stakeholders to the Teams. However, channels and Teams accumulate over time, and it is easy to lose track of who is in which Teams and therefore has access to the associated data.
Furthermore, it is not always desirable that external persons, who may only have been involved in a project for a short time, continue to have access to the data. To counter this situation, you can regularly dig through all the team's and check who is a member of those teams. But this is pretty time-consuming, and each teams owner would have to do it individually. And let's be honest, very few people have that kind of time.
Wouldn't it be practical if every team owner regularly received a completely automated report with all guests in their teams?
A considerable advantage of the cloud are APIs as they allow you to interact with the provider's various services and programs. In Microsoft's realm, the MS Graph API is the way to go if you want to interact with Microsoft's services. But it's not just Microsoft. Most software vendors such as Bexio, Hakuna, Hubspot, Mailchimp and many more also provide an API interface. APIs are the cornerstone of the communication between different programs, hence for automation.
Nevertheless, how does this help us in our case?
Get Teams Information
MS Graph enables us to read out all the teams that contain external users/guests and group them according to the team owner. In the end, we'll have an overview with all guests and users for each team owner.
Thanks to this endpoint, we'll get all Teams groups (in the Microsoft world, Teams are groups in the background which are marked by the resourceProvisioningOptions tag "Team")
GET /groups?$filter=resourceProvisioningOptions/Any(x:x eq 'Team')
The following step is to read out the members for each team
GET /groups/{id}/members
Send report by email
However, a question is still open: how should this information now get to the respective owners?
Here, again, the MS Graph API is our best friend. Of course, Outlook also has such an interface and allows us to send emails through it.
POST /users/{id | userPrincipalName}/sendMail
Automated triggering with a timer
To create and send this report automatically, let's say once a month, the code making these queries and triggering the email to be sent must be executed somewhere. And it has to do this every week.
At this point, Azure Functions come into the game. These allow us to run code in a serverless environment. That means we don't have to worry about setting up and running a server. Our sole focus is on the code. isn't it wonderful? In our example, Microsoft takes care of everything behind the scenes and does the "hard work" for us.
Azure functions have different triggering mechanisms. On the one hand, I can make the functions available as an API, allowing other programs to interact with my function. Or I can trigger them via a timer. So for example, always on the 1st of the month at 09:00.
Cost-effective
And what of the induced costs? You only pay for what you use. Since the report is only generated once a month, there are hardly any costs.
Azure Functions consumption plan is billed based on per-second resource consumption and executions. Consumption plan pricing includes a monthly free grant of 1 million requests and 400,000 GB-s of resource consumption per month per subscription in pay-as-you-go pricing across all function apps in that subscription.
Take advantage of cloud technologies
The various cloud services take a lot of complexity off our shoulders and enable us to create such reports or other automation with relatively little effort.
Modern cloud technologies such as Azure Functions make it easier to automate tasks, freeing up time to focus on the main business tasks. API interfaces allow different programs to communicate, link their data and thus generate more value. (Almost) anything is possible. There are no limits to creativity.
I wanted to use this small example to show you what's possible.
Do you have tasks that need to be automated? Programs that need to communicate with each other but don't? Ideas on how you want to digitize your business?
Feel free to contact us. Together we work out what is possible and what is worthwhile.