In teams, go to the connectors menu entry in the team / channel you want to connect, and create a new incoming webhook. This generates a URL.
In Sentry, go to Settings > Projects > Project > Webhooks (In Legacy Integrations section). You have to put the Teams URL there, and then click “Test plugin” to see if it’s working. I tried with an old version of on-premise and works, not sure if the last version works too.
Here you have an example of error (in PHP project)