Skip to content

Commit 7875e92

Browse files
authored
Merge pull request #77059 from spelluru/labautoshutdown0516
shutdown article
2 parents c341ff3 + bec2042 commit 7875e92

11 files changed

+185
-0
lines changed

articles/lab-services/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@
190190
items:
191191
- name: Set policies and schedules
192192
href: devtest-lab-set-lab-policy.md
193+
- name: Send autoshutdown notifications
194+
href: devtest-lab-auto-shutdown.md
193195
- name: Configure cost management
194196
href: devtest-lab-configure-cost-management.md
195197
- name: Configure Azure Marketplace images
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
title: Manage autoshutdown policies in Azure DevTest Labs | Microsoft Docs
3+
description: Learn how to set autoshutdown policy for a lab so that virtual machines are automatically shut down when they are not in use.
4+
services: devtest-lab,virtual-machines,lab-services
5+
documentationcenter: na
6+
author: spelluru
7+
manager: femila
8+
editor: ''
9+
10+
ms.assetid:
11+
ms.service: lab-services
12+
ms.workload: na
13+
ms.tgt_pltfrm: na
14+
ms.devlang: na
15+
ms.topic: article
16+
ms.date: 05/17/2019
17+
ms.author: spelluru
18+
19+
---
20+
21+
# Manage autoshutdown policies for a lab in Azure DevTest Labs
22+
Azure DevTest Labs enables you to control cost and minimize waste in your labs by managing policies (settings) for each lab. This article shows you how to configure autoshutdown policy for a lab account and configure autoshutdown settings for a lab in the lab account. To view how to set every lab policy, see [Define lab policies in Azure DevTest Labs](devtest-lab-set-lab-policy.md).
23+
24+
## Set auto shutdown policy for a lab
25+
As a lab owner, you can configure a shutdown schedule for all the VMs in your lab. By doing so, you can save costs from running machines that aren't being used (idle). You can enforce a shutdown policy on all your lab VMs centrally but also save your lab users the effort from setting up a schedule for their individual machines. This feature enables you to set the policy on your lab schedule starting from offering no control to full control, to your lab users. As a lab owner, you can configure this policy by taking the following steps:
26+
27+
1. On the home page for your lab, select **Configuration and policies**.
28+
2. Select **Auto shutdown policy** in the **Schedules** section of the left menu.
29+
3. Select one of the options. The following sections give you more details about these options: The set policy applies only to new VMs created in the lab and not to the already existing VMs.
30+
31+
![Auto shut down policy options](./media/devtest-lab-set-lab-policy/auto-shutdown-policy-options.png)
32+
33+
## Configure auto shutdown settings
34+
The autoshutdown policy helps to minimize lab waste by allowing you to specify the time that this lab's VMs shut down.
35+
36+
To view (and change) the policies for a lab, follow these steps:
37+
38+
1. Sign in to the [Azure portal](https://portal.azure.com).
39+
2. Select **All services**, and then select **DevTest Labs** from the list.
40+
3. From the list of labs, select the desired lab.
41+
4. Select **Configuration and policies**.
42+
43+
![Policy settings pane](./media/devtest-lab-set-lab-policy/policies-menu.png)
44+
5. On the lab's **Configuration and policies** pane, select **Auto-shutdown** under **Schedules**.
45+
46+
![Autoshutdown](./media/devtest-lab-set-lab-policy/auto-shutdown.png)
47+
6. Select **On** to enable this policy, and **Off** to disable it.
48+
7. If you enable this policy, specify the time (and time zone) to shut down all VMs in the current lab.
49+
8. Specify **Yes** or **No** for the option to send a notification 15 minutes prior to the specified autoshutdown time. If you choose **Yes**, enter a webhook URL endpoint or email address specifying where you want the notification to be posted or sent. The user receives notification and is given the option to delay the shutdown. For more information, see the [Notifications](#notifications) section.
50+
9. Select **Save**.
51+
52+
By default, once enabled, this policy applies to all VMs in the current lab. To remove this setting from a specific VM, open the VM's management pane and change its **Autoshutdown** setting.
53+
54+
### User sets a schedule and can opt out
55+
If you set your lab to this policy, the lab users can override or opt out of the lab schedule. This option grants lab users full control over auto shutdown schedule of their VMs. Lab users see no change in their VM auto shutdown schedule page.
56+
57+
![Auto shut down policy option - 1](./media/devtest-lab-set-lab-policy/auto-shutdown-policy-option-1.png)
58+
59+
### User sets a schedule and cannot opt out
60+
If you set your lab to this policy, lab users can override the lab schedule. However, they can't opt out of auto shutdown policy. This option makes sure that every machine in your lab is under an auto shutdown schedule. Lab users can update auto shutdown schedule of their VMs, and set up shut down notifications.
61+
62+
![Auto shut down policy option - 2](./media/devtest-lab-set-lab-policy/auto-shutdown-policy-option-2.png)
63+
64+
### User has no control over the schedule set by lab admin
65+
If you set your lab to this policy, lab users can't override or opt out of the lab schedule. This option offers lab admin the complete control on the schedule for every machine in the lab. Lab users can only set up auto shutdown notifications for their VMs.
66+
67+
![Auto shut down policy option - 3](./media/devtest-lab-set-lab-policy/auto-shutdown-policy-option-3.png)
68+
69+
## Notifications
70+
Once autoshutdown set up by the lab owner, notifications will be sent to the lab users 15 minutes before the autoshutdown triggered if any of their VMs will be affected. This option gives lab users a chance to save their work before the shutdown. The notification also provides links for each VM for the following actions:
71+
72+
- Skip the autoshutdown for this time
73+
- Snooze the autoshutdown for an hour or 2 hours, so that they can keep working on the VM.
74+
75+
Notification is sent through the configured web hook endpoint or an email address specified by lab owners in the autoshutdown settings. Webhooks allow you to build or set up integrations that subscribe to certain events. When one of those events is triggered, DevTest Labs will send an HTTP POST payload to the webhook's configured URL. For more information about webhooks, see [Create a webhook or API Azure Function](../azure-functions/functions-create-a-web-hook-or-api-function.md).
76+
77+
We recommend you to use web hooks because they're extensively supported by various apps (for example, Slack, Azure Logic Apps, and so on.) and allows you to implement your own way for sending notifications. As an example, this article walks you through how to get autoshutdown notification from emails by using Azure Logic Apps. First, let's quickly go through the basic steps to enable autoshutdown notification in your lab.
78+
79+
## Create a logic app that receives email notifications
80+
[Azure Logic Apps](../logic-apps/logic-apps-overview.md) provides many out-of-the-box connectors that makes it easy to integrate a service with other clients, like Office 365 and twitter. At the high level, the steps to set up a Logic App for email notification can be divided into four phases:
81+
82+
- Create a logic app.
83+
- Configure the built-in template.
84+
- Integrate with your email client
85+
- Get the Webhook URL.
86+
87+
### Create a logic app
88+
To get started, create a logic app in your Azure subscription by using the following steps:
89+
90+
1. Select **+ Create a resource** on the left menu, select **Integration**, and select **Logic App**.
91+
92+
![New logic app menu](./media/devtest-lab-auto-shutdown/new-logic-app.png)
93+
2. On the **Logic App - Create** page, follow these steps:
94+
1. Enter a **name** for the logic app.
95+
2. Select your Azure **subscription**.
96+
3. Create a new **resource group** or select an existing resource group.
97+
4. Select a **location** for the logic app.
98+
99+
![New logic app - settings](./media/devtest-lab-auto-shutdown/new-logic-app-page.png)
100+
3. In the **Notifications**, select **Go to resource** on the notification.
101+
102+
![Go to resource](./media/devtest-lab-auto-shutdown/go-to-resource.png)
103+
4. Select **Logic app designer** under **Deployment Tools** category.
104+
105+
![Select HTTP Request/Response](./media/devtest-lab-auto-shutdown/select-http-request-response-option.png)
106+
5. On the **HTTP Request-Response** page, select **Use this template**.
107+
108+
![Select Use this template option](./media/devtest-lab-auto-shutdown/select-use-this-template.png)
109+
6. Copy the following JSON into the **Request Body JSON Schema** section:
110+
111+
```json
112+
{
113+
"$schema": "http://json-schema.org/draft-04/schema#",
114+
"properties": {
115+
"delayUrl120": {
116+
"type": "string"
117+
},
118+
"delayUrl60": {
119+
"type": "string"
120+
},
121+
"eventType": {
122+
"type": "string"
123+
},
124+
"guid": {
125+
"type": "string"
126+
},
127+
"labName": {
128+
"type": "string"
129+
},
130+
"owner": {
131+
"type": "string"
132+
},
133+
"resourceGroupName": {
134+
"type": "string"
135+
},
136+
"skipUrl": {
137+
"type": "string"
138+
},
139+
"subscriptionId": {
140+
"type": "string"
141+
},
142+
"text": {
143+
"type": "string"
144+
},
145+
"vmName": {
146+
"type": "string"
147+
}
148+
},
149+
"required": [
150+
"skipUrl",
151+
"delayUrl60",
152+
"delayUrl120",
153+
"vmName",
154+
"guid",
155+
"owner",
156+
"eventType",
157+
"text",
158+
"subscriptionId",
159+
"resourceGroupName",
160+
"labName"
161+
],
162+
"type": "object"
163+
}
164+
```
165+
166+
![Request Body JSON Schema](./media/devtest-lab-auto-shutdown/request-json.png)
167+
7. Select **+ New step** in the designer, and follow these steps:
168+
1. Search for **Office 365 Outlook - Send an email**.
169+
2. Select **Send an email** from **Actions**.
170+
171+
![Send email option](./media/devtest-lab-auto-shutdown/select-send-email.png)
172+
3. Select **Sign in** to sign into your email account.
173+
4. Select **TO** field, and choose owner.
174+
5. Select **SUBJECT**, and input a subject of the email notification. For example: "Shutdown of machine vmName for Lab: labName."
175+
6. Select **BODY**, and define the body content for email notification. For example: "vmName is scheduled to shut down in 15 minutes. Skip this shutdown by clicking: URL. Delay shutdown for an hour: delayUrl60. Delay shutdown for 2 hours: delayUrl120."
176+
177+
![Request Body JSON Schema](./media/devtest-lab-auto-shutdown/email-options.png)
178+
1. Select **Save** on the toolbar. Now, you can copy the **HTTP POST URL**. Select the copy button to copy the URL to the clipboard.
179+
180+
![WebHook URL](./media/devtest-lab-auto-shutdown/webhook-url.png)
181+
182+
## Next steps
183+
To learn how to set all policies, see [Define lab policies in Azure DevTest Labs](devtest-lab-set-lab-policy.md).
106 KB
Loading
23.7 KB
Loading
29.8 KB
Loading
96.9 KB
Loading
46.8 KB
Loading
92.3 KB
Loading
56.2 KB
Loading
23.5 KB
Loading

0 commit comments

Comments
 (0)