Skip to content

Commit 957d91f

Browse files
authored
Merge pull request #58084 from dominicbetts/ranjitha-review
Add Email Actions to release branch
2 parents 2482c3b + 07876c0 commit 957d91f

File tree

14 files changed

+203
-20
lines changed

14 files changed

+203
-20
lines changed
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
---
2+
title: Email action within Remote Monitoring - Azure | Microsoft Docs
3+
description: This how-to guide shows you how to add an email action to a new or existing rule.
4+
author: asdonald
5+
manager: hegate
6+
ms.author: asdonald
7+
ms.service: iot-accelerators
8+
services: iot-accelerators
9+
ms.date: 11/12/2018
10+
ms.topic: conceptual
11+
12+
# As a developer, I want to add email as an action to a new or existing rule within my Remote Monitoring solution.
13+
---
14+
15+
# Add an email action
16+
17+
Email actions help make sure you never miss alerts. You can add an email action to an existing rule, or when you create a new rule.
18+
19+
[!INCLUDE [iot-accelerators-tutorial-prereqs](../../includes/iot-accelerators-tutorial-prereqs.md)]
20+
21+
To create or modify a rule, you must be an [**Administrator**, or have the correct permissions](iot-accelerators-remote-monitoring-rbac.md).
22+
23+
## Edit an existing rule
24+
25+
Follow these steps to add an email action to an existing rule:
26+
27+
1. Navigate to your Remote Monitoring solution.
28+
29+
1. From the **Dashboard**, navigate to the **Rules** page:
30+
31+
![Rules page](./media/iot-accelerators-remote-monitoring-email-actions/rules.png)
32+
33+
1. Click the checkbox next to the existing rule to modify, and then click **Edit** at the top. An editable **Rule** panel appears.
34+
35+
1. In the **Action** section, toggle **Email enabled** to **On**.
36+
37+
1. The first time you enable an email action in the solution accelerator, you must [sign in to Outlook](#outlook).
38+
39+
1. Enter an email address into the recipient box and press the **Enter** key for each email address to add:
40+
41+
![Address entry](./media/iot-accelerators-remote-monitoring-email-actions/address.png)
42+
43+
1. Enter a subject for the email.
44+
45+
1. Enter any additional notes for the email recipients as plain text. You can use HTML formatting if you [edit the email template](#htmledit).
46+
47+
1. Make sure that the **Rule Status** is set to **Enabled**.
48+
49+
1. Click **Apply**.
50+
51+
## Create a new rule
52+
53+
Follow these steps to add an email action when you create a new rule:
54+
55+
1. Navigate to your Remote Monitoring solution.
56+
57+
1. From the **Dashboard**, navigate to the **Rules** page:
58+
59+
![Rules page](./media/iot-accelerators-remote-monitoring-email-actions/rules.png)
60+
61+
1. Follow the steps in the [create a rule section](iot-accelerators-remote-monitoring-automate.md#create-a-rule). The follow the steps in the [create an advanced rule](iot-accelerators-remote-monitoring-automate.md#create-an-advanced-rule) section up to the point where you set a **Severity level**. Don't click **Apply** yet.
62+
63+
1. In the **Action** section, toggle **Email enabled** to **On**.
64+
65+
1. The first time you enable an email action in the solution accelerator, you must [sign in to Outlook](#outlook).
66+
67+
1. Enter an email address into the recipient box and press the **Enter** key for each email address to add:
68+
69+
![Address entry](./media/iot-accelerators-remote-monitoring-email-actions/address.png)
70+
71+
1. Enter a subject for the email.
72+
73+
1. Enter any additional notes for the email recipients as plain text. You can use HTML formatting if you [edit the email template](#htmledit).
74+
75+
1. Make sure that the **Rule Status** is set to **Enabled**.
76+
77+
1. Click **Apply**.
78+
79+
Your rule with an email action is now enabled. Each time the action is triggered, a new email is sent to the recipients.
80+
81+
## Sign in to Outlook <a name="outlook"></a>
82+
83+
The first time you enable an email action in your solution accelerator, you must sign into Outlook. This action sets up the email account that sends out the email notifications.
84+
85+
> [!NOTE]
86+
> You should create a specific Outlook account just for solution accelerator notifications and use that account when you enable your first email action.
87+
88+
### Contributor role Outlook setup
89+
90+
If someone in the **contributor** role in the subscription deployed the solution accelerator, the application doesn't have sufficient permissions to set up and verify email actions through the Web UI.
91+
92+
Before you start, create an Outlook account to use to send email notifications from your solution accelerator.
93+
94+
The following steps show you how to set up and verify the email actions manually:
95+
96+
1. Navigate to the [Azure portal](https://portal.azure.com).
97+
98+
1. Navigate to the Resource Group for your solution accelerator.
99+
100+
1. Click the **office365-connector**:
101+
102+
![API Connection](./media/iot-accelerators-remote-monitoring-email-actions/apiconnector.png)
103+
104+
1. Click the banner to begin the authorization process:
105+
106+
![authorize](./media/iot-accelerators-remote-monitoring-email-actions/connector.png)
107+
108+
1. Click **Authorize**. You're prompted to sign in. The account you use to sign in should be the email address the application uses to send email notifications:
109+
110+
![Authorize button](./media/iot-accelerators-remote-monitoring-email-actions/authorize.png)
111+
112+
1. Click **Save** at the bottom. Your authorization will be successful if the banner is gone.
113+
114+
1. To change the email address from which the notifications are sent from, click **Edit API connection**.
115+
116+
![change email](./media/iot-accelerators-remote-monitoring-email-actions/editemail.png)
117+
118+
### Owner role Outlook setup
119+
120+
If someone in the **owner** role in the subscription deployed the solution accelerator, the application can verify email actions have been correctly set up through the Web UI.
121+
122+
Before you start, create an Outlook account to use to send email notifications from your solution accelerator.
123+
124+
The following steps help you to sign in and set up email actions:
125+
126+
1. Click to sign in to Outlook. You're taken to the Azure portal:
127+
128+
![Sign in to Outlook](./media/iot-accelerators-remote-monitoring-email-actions/owneroutlook.png)
129+
130+
1. Click **Authorize**. You're prompted to sign in. The account you use to sign in should be the email address the application uses to send email notifications:
131+
132+
1. Click **Save**. Return to your solution accelerator and refresh the page.
133+
134+
1. If you've successfully configured the email notification, you see this message:
135+
136+
![Successful Outlook sign in](./media/iot-accelerators-remote-monitoring-email-actions/success.png)
137+
138+
## Customize the email HTML <a name="htmledit"></a>
139+
140+
Out-of-the-box, the Remote Monitoring solution accelerator provides a basic HTML template for action emails. The email template uses values from the email action settings. Here's an example email:
141+
142+
![email example](./media/iot-accelerators-remote-monitoring-email-actions/emailtemplate.png)
143+
144+
The following steps show you how to edit the HTML email template. For example, you can include more information or add custom images:
145+
146+
1. Clone either the Java or .NET Remote Monitoring GitHub repository:
147+
148+
1. Navigate to the email template location:
149+
150+
`Dotnet: device-telemetry\ActionsAgent\data\EmailTemplate.html`
151+
152+
`Java device-telemetry/app/resources/data/EmailTemplate.html`
153+
154+
1. You can add or remove any parameters in this template to customize the message. You can also add, remove, or replace calls as needed:
155+
156+
For example, in the .NET code:
157+
`emailTemplate = emailTemplate.Replace("${subject}", emailAction.GetSubject());`
158+
159+
For example, in the Java code:
160+
`this.emailTemplate.replace("${subject}", emailAction.GetSubject());`
161+
162+
1. Parameters in the template take the form of `${...}`. To delete a parameter, delete the required line. To add a parameter, add a line with the value to insert.
163+
164+
1. To add images or custom text, update the EmailTemplate.HTML file directly.
165+
166+
## Throttling
167+
168+
The Remote Monitoring solution accelerator uses Outlook to send email notifications. Outlook limits the number of emails sent to [30 emails per 1 minute](https://docs.microsoft.com/office365/servicedescriptions/exchange-online-service-description/exchange-online-limits#receiving-and-sending-limits). Email clients receiving the emails may also throttle the number of emails received per minute. Check with your specific email client on limitations. When you set up email notification for a rule, the rule should calculate average values over a period of at least one minute, and not use instant values:
169+
170+
![Average calculation](./media/iot-accelerators-remote-monitoring-email-actions/calculation.png)
171+
172+
## Next steps
173+
174+
This guide showed you how to add an email action to a new or existing rule within a Remote Monitoring solution. The guide also showed you and how to edit the HTML that defines the message format.
175+
176+
The suggested next step is to learn [how to use alerts and fix device issues](iot-accelerators-remote-monitoring-maintain.md).

articles/iot-accelerators/iot-accelerators-remote-monitoring-rbac.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,33 @@ This article provides information about how to configure role-based access contr
2020

2121
When you first deploy the Remote Monitoring solution, there are two roles: **Admin** and **Read Only**.
2222

23-
Any user in the **Admin** role has full access to the solution. A user in the **Read Only** role can't do any of the following tasks:
24-
25-
- Update alarms
26-
- Delete alarms
27-
- Create devices
28-
- Update devices
29-
- Delete devices
30-
- Create device groups
31-
- Update device groups
32-
- Delete device groups
33-
- Create rules
34-
- Update rules
35-
- Delete rules
36-
- Create jobs
37-
- Update SIM management
38-
39-
The person who deploys the Remote Monitoring solution is automatically assigned to the **Admin** role and is an Azure Active Directory application owner. As an application owner you can assign roles to other users in the Azure portal.
40-
41-
If you want another user to assign roles in the solution, they must also be set as an application owner in the Azure portal.
23+
Any user in the **Admin** role has full access to the solution, including the following permissions below. A user in the **Read Only** role will only have access to view the solution.
24+
25+
| Permission | Admin | Read Only |
26+
|---------------- |-------|-----------|
27+
| View Solution | Yes | Yes |
28+
| Update alarms | Yes | No |
29+
| Delete alarms | Yes | No |
30+
| Create devices | Yes | No |
31+
| Update devices | Yes | No |
32+
| Delete devices | Yes | No |
33+
| Create device groups | Yes | No |
34+
| Update device groups | Yes | No |
35+
| Delete device groups | Yes | No |
36+
| Create rules | Yes | No |
37+
| Update rules | Yes | No |
38+
| Delete rules | Yes | No |
39+
| Create jobs | Yes | No |
40+
| Update SIM management | Yes | No |
41+
42+
By default, the user who deployed the solution is automatically assigned the **Admin** role and is an Azure Active Directory application owner. As an application owner, you can assign roles to other users through the Azure portal. If you want another user to assign roles in the solution, they must also be set as an application owner in the Azure portal.
43+
44+
> [!NOTE]
45+
> The user who deployed the solution is the **only person** who can view it immediately after its been created. To grant others access to view the application as either a Read Only, Admin, or a Custom role, see the following directions below on add or remove users.
4246
4347
## Add or remove users
4448

45-
Use the Azure portal to add or remove a user from the Remote Monitoring solution. The following steps use the [Azure Active Directory enterprise application](../active-directory/manage-apps/add-application-portal.md#find-your-azure-ad-tenant-application) that was created for you when you deployed the Remote Monitoring solution.
49+
As an Azure Active Directory application owner, you can use the Azure portal to add or remove a user to a role from the Remote Monitoring solution. The following steps use the [Azure Active Directory enterprise application](../active-directory/manage-apps/add-application-portal.md#find-your-azure-ad-tenant-application) that was created when you deployed the Remote Monitoring solution.
4650

4751
1. Sign in to the [Azure portal](https://portal.azure.com).
4852

7.45 KB
Loading
4.89 KB
Loading
54.9 KB
Loading
4.29 KB
Loading
17.5 KB
Loading
28.9 KB
Loading
21.6 KB
Loading
29.9 KB
Loading

0 commit comments

Comments
 (0)