š„Building a Teams Bot with AI Capabilities - Part 3 - Delegated Permissions and Making Lambda Stateful for Oauth2š„
aka, "do you remember me?"
This blog series focuses on presenting complex DevOps projects as simple and approachable via plain language and lots of pictures. You can do it!
These articles are supported by readers, please consider subscribing to support me writing more of these articles <3 :)
This article is part of a series of articles, because 1 article would be absolutely massive.
Part 3 (this article): Delegated Permissions and Making Lambda Stateful for Oauth2
Hey all!
During the last two articles, we talked about how to get started building a Teams Bot - we built the manifest, registered the Bot resource, and linked it to an App Registration. That App Registration contains all sorts of wonderful permissions that we need to use in order to build conversation context and operate as a bot.
However, all the permissions are set as Delegated - that means that the Bot canāt do those things itself - it has no rights at all, since all the permissions are āDelegatedā (vs āApplicationā permissions).
I talked to our Azure admin about just granting the Bot Application permissions to:
Read all Channels
Read all Messages in any channel
Read all private chats
And he just laughed and laughed. Granting a static permission to a bot to work like that would be bizzare - thatās way too many permissions! And if someone was able to steal the Client ID and Client Secret, they could exfiltrate absolutely all data from our Teams.
Thus, delegated permissions.
Lets talk about what delegated permissions are, and then talk about how the changes we need to make to our Receiver lambda (that is obviously stateless, itās a lambda), to operate in a stateful way.
Donāt understand why our Receiver lambda needs state? Well, read on! Itās all about the OAuth2 token delivery safety mechanism in Azure
If youād rather skip right to the code, this tool is available and open source. Please, go build!
Keep reading with a 7-day free trial
Subscribe to Let's Do DevOps to keep reading this post and get 7 days of free access to the full post archives.