Skip to content

Commit 8882417

Browse files
Merge pull request #245540 from yegu-ms/main
Added SMTP config testing
2 parents 09efe07 + 6829374 commit 8882417

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

articles/managed-grafana/how-to-smtp-settings.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To follow the steps in this guide, you must have:
2525

2626
## Enable and configure SMTP settings
2727

28-
To activate SMTP settings, enable email notifications and configure an email contact point in Azure Managed Grafana, follow the steps below.
28+
Follow these steps to activate SMTP settings, enable email notifications and configure an email contact point in Azure Managed Grafana.
2929

3030
### [Portal](#tab/azure-portal)
3131

@@ -43,7 +43,7 @@ To activate SMTP settings, enable email notifications and configure an email con
4343
| From Address | [email protected] | Enter the email address used when sending out emails. |
4444
| From Name | Azure Managed Grafana Notification | Enter the name used when sending out emails. Default is "Azure Managed Grafana Notification" if parameter isn't given or empty. |
4545
| Skip Verify | Disable |This setting controls whether a client verifies the server's certificate chain and host name. If **Skip Verify** is **Enable**, client accepts any certificate presented by the server and any host name in that certificate. In this mode, TLS is susceptible to machine-in-the-middle attacks unless custom verification is used. Default is **Disable** (toggled off). [More information](https://pkg.go.dev/crypto/tls#Config). |
46-
| StartTLS Policy | OpportunisticStartTLS | There are 3 options. [More information](https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy).<br><ul><li>**OpportunisticStartTLS** means that SMTP transactions are encrypted if STARTTLS is supported by the SMTP server. Otherwise, messages are sent in the clear. This is the default setting.</li><li>**MandatoryStartTLS** means that SMTP transactions must be encrypted. SMTP transactions are aborted unless STARTTLS is supported by the SMTP server.</li><li>**NoStartTLS** means encryption is disabled and messages are sent in the clear.</li></ul> |
46+
| StartTLS Policy | OpportunisticStartTLS | There are three options. [More information](https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy).<br><ul><li>**OpportunisticStartTLS** means that SMTP transactions are encrypted if STARTTLS is supported by the SMTP server. Otherwise, messages are sent in the clear. It's the default setting.</li><li>**MandatoryStartTLS** means that SMTP transactions must be encrypted. SMTP transactions are aborted unless STARTTLS is supported by the SMTP server.</li><li>**NoStartTLS** means encryption is disabled and messages are sent in the clear.</li></ul> |
4747

4848
1. Select **Save** to save the SMTP settings. Updating may take a couple of minutes.
4949

@@ -54,7 +54,7 @@ To activate SMTP settings, enable email notifications and configure an email con
5454
### [Azure CLI](#tab/azure-cli)
5555

5656
1. Azure Managed Grafana CLI extension 1.1 or above is required to enable or update SMTP settings. To update your extension, run `az extension update --name amg`.
57-
1. Run the [az grafana update](/cli/azure/grafana#az-grafana-update) command to configure SMTP settings for a given Azure Managed Grafana instance. When doing this, replace the placeholders below with information from your own instance.
57+
1. Run the [az grafana update](/cli/azure/grafana#az-grafana-update) command to configure SMTP settings for a given Azure Managed Grafana instance. Replace the placeholders with information from your own instance.
5858

5959
```azurecli
6060
az grafana update --resource-group <resource-group> \
@@ -79,7 +79,7 @@ To activate SMTP settings, enable email notifications and configure an email con
7979
| `--host` | test.sendgrid.net:587 | Enter the SMTP server hostname with port. |
8080
| `--user` | admin | Enter the name of the user of the SMTP authentication. |
8181
| `--password` | password | Enter password of the SMTP authentication. If the password contains "#" or ";" wrap it within triple quotes. |
82-
| `--start-tls-policy` | OpportunisticStartTLS | The StartTLSPolicy setting of the SMTP configuration. There are 3 options. [More information](https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy).<br><ul><li>**OpportunisticStartTLS** means that SMTP transactions are encrypted if STARTTLS is supported by the SMTP server. Otherwise, messages are sent in the clear. This is the default setting.</li><li>**MandatoryStartTLS** means that SMTP transactions must be encrypted. SMTP transactions are aborted unless STARTTLS is supported by the SMTP server.</li><li>**NoStartTLS** means encryption is disabled and messages are sent in the clear.</li></ul> |
82+
| `--start-tls-policy` | OpportunisticStartTLS | The StartTLSPolicy setting of the SMTP configuration. There are three options. [More information](https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy).<br><ul><li>**OpportunisticStartTLS** means that SMTP transactions are encrypted if STARTTLS is supported by the SMTP server. Otherwise, messages are sent in the clear. This is the default setting.</li><li>**MandatoryStartTLS** means that SMTP transactions must be encrypted. SMTP transactions are aborted unless STARTTLS is supported by the SMTP server.</li><li>**NoStartTLS** means encryption is disabled and messages are sent in the clear.</li></ul> |
8383
| `--skip-verify` | false |This setting controls whether a client verifies the server's certificate chain and host name. If **--skip-verify** is **true**, client accepts any certificate presented by the server and any host name in that certificate. In this mode, TLS is susceptible to machine-in-the-middle attacks unless custom verification is used. Default is **false**. [More information](https://pkg.go.dev/crypto/tls#Config). |
8484
8585
---
@@ -88,6 +88,30 @@ To activate SMTP settings, enable email notifications and configure an email con
8888
> Here are some tips for properly configuring SMTP:
8989
>- When using a business email account such as Office 365, you may need to contact your email administrator to enable SMTP AUTH (for example, [enable-smtp-auth-for-specific-mailboxes](/exchange/clients-and-mobile-in-exchange-online/authenticated-client-smtp-submission#enable-smtp-auth-for-specific-mailboxes)). You should be able to create an app password afterwards and use it as the SMTP *password* setting.
9090
>- When using a personal email account such as Outlook or Gmail, you should create an app password and use it as the SMTP *password* setting. Note that your account won't work for email notification if it's configured with multi-factor authentication.
91+
>- It's recommended that you verify the SMTP configurations to be working as expected before applying them to your Managed Grafana workspace. For example, you can use an open source tool such as [swaks (Swiss Army Knife for SMTP)](https://github.com/jetmore/swaks) to send a test email using the SMTP configurations by running the following command in a terminal window:
92+
> ```bash
93+
> # fill in all the empty values for the following parameters
94+
> host="" # SMTP host name with port separated by a ":", e.g. smtp.office365.com:587
95+
> user="" # email address, e.g. [email protected]
96+
> password="" # password
97+
> fromAddress="" # source email address (usually the same as user above), e.g. [email protected]
98+
> toAddress="" # destination email address, e.g. [email protected]
99+
> ehlo="" # grafana endpoint, e.g. team1-ftbghja6ekeybng8.wcus.grafana.azure.com
100+
>
101+
> header="Subject:Test"
102+
> body="Testing!"
103+
>
104+
> # test SMTP connection by sending an email
105+
> swaks --auth -tls \
106+
> --server $host \
107+
> --auth-user $user \
108+
> --auth-password $password \
109+
> --from $fromAddress \
110+
> --to $toAddress \
111+
> --ehlo $ehlo \
112+
> --header $header \
113+
> --body $body
114+
> ```
91115
92116
## Configure Grafana contact points and send a test email
93117
@@ -102,11 +126,11 @@ Configuring Grafana contact points is done in the Grafana portal:
102126
1. Add or update the **Name**, and **Contact point type**.
103127
1. Enter a destination email under **Addresses**, and select **Test**.
104128
1. Select **Send test notification** to send the notification with the predefined test message or select **Custom** to first edit the message.
105-
1. A notification "Test alert sent" is displayed, meaning that the email setup has been successfully configured. The test email has been sent to the provided email address. In case of misconfiguration, an error message will be displayed instead.
129+
1. A notification "Test alert sent" is displayed, meaning that the email setup has been successfully configured. The test email has been sent to the provided email address. If there is a misconfiguration, an error message is shown instead.
106130
107131
## Disable SMTP settings
108132
109-
To disable SMTP settings, follow the steps below.
133+
To disable SMTP settings, follow these steps.
110134
111135
### [Portal](#tab/azure-portal)
112136
@@ -116,7 +140,7 @@ To disable SMTP settings, follow the steps below.
116140
### [Azure CLI](#tab/azure-cli)
117141
118142
1. Azure Managed Grafana CLI extension 1.1 or above is required to disable SMTP settings. To update your extension, run `az extension update --name amg`.
119-
1. Run the [az grafana update](/cli/azure/grafana#az-grafana-update) command to configure SMTP settings for a given Azure Managed Grafana instance. Replace the placeholders below with information from your own instance.
143+
1. Run the [az grafana update](/cli/azure/grafana#az-grafana-update) command to configure SMTP settings for a given Azure Managed Grafana instance. Replace the placeholders with information from your own instance.
120144
121145
```azurecli
122146
az grafana update --resource-group <resource-group> \
@@ -139,14 +163,10 @@ To disable SMTP settings, follow the steps below.
139163
140164
Within the Grafana portal, you can find a list of all Grafana alerting error messages that occurred in **Alerting > Notifications**.
141165
142-
Below are some common error messages you may encounter:
166+
The following are some common error messages you may encounter:
143167
144168
- "Authentication failed: The provided authorization grant is invalid, expired, or revoked". Grafana couldn't connect to the SMTP server. Check if the password entered in the SMTP settings in the Azure portal is correct.
145-
- "Failed to sent test alert.: SMTP not configured". SMTP is disabled. Open the Azure Managed Grafana instance in the Azure portal and enable SMTP settings.
146-
147-
## Known limitation
148-
149-
Due to limitation on alerting high availability configuration in Azure Managed Grafana, there could be duplicate email notifications delivered for a single firing alert.
169+
- "Failed to sent test alert: SMTP not configured". SMTP is disabled. Open the Azure Managed Grafana instance in the Azure portal and enable SMTP settings.
150170
151171
## Next steps
152172

0 commit comments

Comments
 (0)