Your Dynatrace environment can integrate with Microsoft Teams channels using Microsoft Teams Connector in automation workflows.
Due to the retirement of Office 365 connectors within Microsoft Teams, Office 365 webhooks will stop working after December 31, 2024.
To continue sending messages from Dynatrace to Microsoft Teams, follow the steps in the Migrating from incoming webhooks to Microsoft Power Automate section.
Dynatrace needs a Microsoft Power Automate webhook for the Microsoft Teams channel where you want to send notifications. The messages in Teams are sent under the name of the user who created the webhook.
To create a Power Automate webhook
External requests enable outbound network connections from your Dynatrace environment to external services. They allow you to control access to public endpoints from the AppEngine with app functions and functions in Dashboards, Notebooks, and Automations.
Go to Settings and select General > Environment management, External Requests.
Select New host pattern.
Add the domain names.
Select Add.
This way you can granularly control the web services your functions can connect to.
For example, you could use *.logic.azure.com
as a domain.
You need to create a connection using the webhook URL
The workflow action can be used to send Markdown-formatted cards or AdaptiveCard format.
Connection: select any connection from the dropdown list (for example, dynatrace-notifications-sandbox
).
Message: see the examples in the following table.
Input type
Sample input
Markdown
**Hello World**This is Markdown-formatted text!
AdaptiveCard
{"type": "AdaptiveCard","actions": [],"body": [{"type": "TextBlock","size": "Medium","weight": "Bolder","text": "Hello World"}],"$schema": "http://adaptivecards.io/schemas/adaptive-card.json","version": "1.4"}
Automation expression
{{ result("build_ms_teams_message_action") }}
Interactions
Select Send test message (under the input field) to send a test message. However, if the message contains any automation expression, the expression will not be processed but sent as is.
Output: The action does not have any output besides logs.
Log output examples
[INFO] POST https://xxxxxxx.webhook.office.com/*** called successfully[INFO] Message has been posted successfully
[ERROR] Received unexpected HTTP Response from API: 503 Service Unavailable[ERROR] POST https://xxxxxxxx.webhook.office.com/*** Unable to communicate with the Teams API: Encountered unknown HTTP status code 503 - Service Unavailable
To create a workflow that sends a message on demand to a Microsoft Teams channel
Go to Workflows and select
to create a new workflow.
In the side panel, select On demand trigger.
On the trigger node, select to browse available actions.
In the side panel, search the actions for Microsoft Teams and select Send message.
In the side panel
Select Save.
If you Run the workflow successfully:
Success
.To create a workflow that sends a daily reminder at a fixed time to a Microsoft Teams channel, you just need to slightly modify the trigger in the previous procedure.
With the previous workflow displayed in your editor
Select the current trigger (On demand trigger).
In the side panel, select Change trigger.
In Select a trigger, select Fixed time trigger.
Define when to send the message.
Every working day
.Select Save.
If you Run the workflow successfully:
Success
.If you use the previous example but paste the following into Message, the message "Daily reminder test - AdaptiveCard format" with the defined formatting will be sent out daily at the time defined in the trigger.
{"type": "AdaptiveCard","actions": [],"body": [{"type": "TextBlock","size": "Medium","weight": "Bolder","text": "Daily reminder test - AdaptiveCard format"}],"$schema": "http://adaptivecards.io/schemas/adaptive-card.json","version": "1.4"}
We don't support Adaptive Cards Template Language templating. Use our templating functionality. For more information, see Dynatrace's expressions. Expressions will be resolved at execution time, creating a static card payload that will be sent.
For instance, let's assume the user wants to create a FactSet
based on a series of inputs. The AdaptiveCard way to develop such a set would be to use the following example:
{"type": "AdaptiveCard","$schema": "http://adaptivecards.io/schemas/adaptive-card.json","version": "1.4","body": [{"type": "FactSet","facts": [{"$data": [{"name": "Name 1","status": "Status 1"},{"name": "Name 2","status": "Status 2"}],"title": "${name}","value": "${status}"}]}]}
To replicate this behavior, the user can use Expressions instead. The same example above can be created with the following snippet:
{%- set data = [{"name": "Name 1","status": "Status 1"},{"name": "Name 2","status": "Status 2"}]-%}{"type": "AdaptiveCard","$schema": "http://adaptivecards.io/schemas/adaptive-card.json","version": "1.4","body": [{"type": "FactSet","facts": [{% for value in data -%}{"title": "{{ value.name }}","value": "{{ value.status }}"} {{ ", " if not loop.last else "" }}{%- endfor %}]}]}
If you're triggering a workflow using a Davis problem or a security notification, you might want to consider the templates that come with the Microsoft Teams Connector action.
To use a template, you need to have an Event trigger targeting event.kind == "SECURITY_EVENT"
, or a Davis problem trigger. For details, see the trigger documentation.
Once the connection is set, you can choose the appropriate template from the list. The template's content will be copied in the message box, ready to be used as is, or modified to suit your needs.
The templates can heavily use the Jinja template syntax. For this reason, we recommend that you familiarize yourself with Jinja before making any changes. Incorrect Jinja expressions can lead to errors when running an action. For example, see "Error evaluating input" when executing the action in the Troubleshooting section.
Identify all connections to be migrated.
When configuring actions in the Workflows app, a warning is displayed for all actions that use an Office 365 webhook.
Additionally, all executions that use an Office 365 webhook connection produce a warning log entry.
Create a Microsoft Power Automate webhook.
Add a New host pattern in External Request.
In existing connections, replace the webhook URL.
optional Delete the Office 365 webhook in MS Teams.
Once all Office 365 webhooks are replaced, delete the outbound connection for the Office 365 webhook domain.
The following are solutions to problems some people have.