Microsoft 365 Connector

  • Latest Dynatrace
  • Reference
  • 6min

You can automate sending out-of-the-box emails using Microsoft 365 Connector Microsoft 365 for Workflows based on the events and schedules defined by your workflows.

Set up

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.

  1. Go to Settings and select General > Environment management, External Requests.

  2. Select New host pattern.

  3. Add the domain names.

  4. Select Add.

This way you can granularly control the web services your functions can connect to.

You need to add these domain names login.microsoftonline.com and graph.microsoft.com.

Workflows requires some permissions to run actions on your behalf. Actions that come bundled with the Connector require other permissions.

To fine-tune permissions granted to Workflows

  1. Go to Workflows Workflows and go to Settings > Authorization settings.
  2. Select the following permissions besides the general Workflows permission.
    • app-settings:objects:read

For more on general Workflows user permissions, see User permissions for workflows.

Configure your Microsoft Azure tenant to establish a connection with your Dynatrace environment.

  1. Open portal.azure.com to access your Microsoft Azure tenant and navigate to App registrations to set up a new app. For the necessary setup steps, see Register a client application in Microsoft Entra ID in Microsoft Azure documentation.

  2. Grant your newly created Azure app the Microsoft Graph/Mail/Mail.Send permission.

    For more information, see API permissions and Introduction to permissions and consent in Microsoft Azure documentation.

    To be able to use the API to send emails in the background without a currently signed-in user, you need to select Application permissions. Delegated permissions aren't sufficient.

  3. After registering the app, create a new client secret. For details, see Certificates & secrets in Microsoft Azure documentation.

    • To create a client secret, make sure that you either have admin permissions or are part of the app owners.
    • Make sure you store the client secret Value (not the Secret ID) after creation for establishing the connection to your Dynatrace environment in the next section.
    Limit mailbox access through an application access policy

    We strongly recommend using a technical email address as the sender used by the Dynatrace Workflows action and limiting the permissions of your Microsoft Azure app registration to these specific mailboxes by setting up an application access policy. This ensures that only specified email addresses can be used in the app registration and eventually in Dynatrace Workflows. This helps to reduce risks from impersonation.

    For details on how to set up a new application access policy, see Limiting application permissions to specific Exchange Online mailboxes in Microsoft Azure documentation.

    If you don't set up an application access policy for your Microsoft Azure tenant and restrict the possible email senders, any email address of your tenant can be used as the sender for your emails sent via Dynatrace Workflows.

    Application access policies can be assigned to users or groups. Microsoft supports groups as outlined in the section PolicyScopeGroupID.

    The from email address must be an online-hosted mailbox.

Microsoft 365 Connector requires a client secret from Microsoft Azure for authorization.

  1. Get the following credentials from your app registration in your Microsoft Azure tenant on portal.azure.com.
  2. Return to Dynatrace, go to Settings and select Connections > Connectors > Microsoft 365.
  3. Select Add Connection and provide the following information.
  4. Select Create.

Additional notes

  • To add connection settings, you need the following permissions.

    ALLOW settings:objects:read, settings:objects:write, settings:schemas:read WHERE settings:schemaId = "app:dynatrace.microsoft365.connector:connection"

    For details, see Permissions and access.

Send an email with workflows

  1. Go to Workflows Workflows and select Add to create a new workflow.

  2. In the side panel, select the trigger best suited to your needs.

  3. On the trigger node, select Add to browse available actions.

  4. In the side panel, search the actions for Microsoft 365 and select Send email.

  5. Select a preconfigured Microsoft 365 connection.

  6. Enter the email addresses for the recipients.

    The number of email addresses is currently restricted to 10 per field.

  7. Enter a subject.

  8. Enter a message.

  9. To test your workflow, select Run.

Format email

To format the body of an email

  1. Select Message.

  2. Enter your text.

    When you select, for example, the bold style, your text is rendered as bold in the sent email. You won't be able to preview it without the formatting symbols. However, when you send an email, the recipient will see the properly formatted text, and the formatting symbols won't be visible.

    You can use the toolbar to insert common elements like a heading, bold text, or a link.

    Attaching an image or inserting JavaScript code into the email body is impossible. It's just shown as plain text.

    Screenshot of a workflow with an email action where the email body text can be formatted.

Format syntax

Italics

Wrap text in single asterisks (*like this*) to get italics like this.

Bold

Wrap text in double asterisks (**like this**) to get bold text like this.

Strikethrough

Wrap text in double tildes (~~like this~~) to get strikethrough (crossed out) text like this.

Code

  • Wrap text in backticks (`like this`) to get bold text like this.

  • Wrap text in triple backticks (```like this```) to show a code block (multiple lines of code text).

Headings

To add a heading, start the line with the # character like this: # This is your heading text.

Horizontal line

To visually separate sections of your annotation, add a horizontal line with three dashes (---):

Lists

Each line of an unordered (bulleted) list starts with an asterisk (*):

* Line 1
* Line 2

Alternatively, you can use a dash (-):

- Line 1
- Line 2

An ordered (numbered) list starts with a number and a period (1.) followed by a space and then your text:

1. The first line of my procedure.
2. The second line of my procedure.
3. The third line of my procedure.

Tables

To add a table, define the headers, the column formatting row, and then the rows of data you want to display

| Header 1 | Header2
--- | ---
content2 | content2
Header 1
Header2
content2
content2

To link to a website, use this format:

[Example text label](https://www.example.com)

Here's a link to the [Dynatrace website](www.dynatrace.com).

Line break

To add a single line break and a new line, select Enter in the Message field of the Connector.

No HTML support

This Connector only allows formatting of the message body using the listed formatting options. It doesn't offer support for HTML.

Action result

The Send email action provides the following result.

Property

Description

requestId

A unique identifier required for reporting issues to Microsoft Support that is returned by the Microsoft API in the response header field request-id

clientRequestId

A unique identifier required for reporting issues to Microsoft Support that is returned by the Microsoft API in the response header field client-request-id

For sending emails, this is identical to requestId.

Sending JSON payloads as message content

When sending an object or non-string data as message content, ensure it is properly formatted as a string. The recommended approach is to wrap your input in an expression and convert it to a JSON string using the to_json filter:

{{ result("run_javascript_1") | to_json }}

This approach ensures your data is properly formatted for transmission. For more information, see Expression reference.

Troubleshooting

The following are solutions to problems some people have.