V
V
vitaliy_bessonov2015-10-21 16:44:29
JavaScript
vitaliy_bessonov, 2015-10-21 16:44:29

How to automate turning on and off servers in the Microsoft Azure cloud?

It is required to organize the ability to turn on and off servers in the cloud by users. The user must fill out the form when he needs access to the server, it is desirable that this form be on some public resource - such as google drive. The user fills in the Enable fields from TIME to TIME, after which the schedule for turning on the servers changes. After that, we send a letter to the mailing group with the text "User USER_NAME", changed the working hours of the servers from 07:00 to 23:45.

Now switching on and off is organized using powershell and task scheduler on one of the servers in the cloud, the schedule is adjusted by the administrator.
How is it possible to automate the process of processing requests from users about the time of turning servers on and off?

This web page is needed so that users can independently set the operating time of the servers in the company. The standard schedule is set by the administrator. Users make changes to it, if necessary.

1. We make a web page with authorization in the Windows domain. Without storing the domain account password anywhere. We need transparent authorization for domain authorized users.

2. After authorization, the user sees a table with the following fields:
Date
Turn on
time Turn off time
User
Change time
2.1. We only display rows starting from the current date minus one day.

3. You need the ability to change the values ​​​​in the fields "On time" and "Off time" in the table. Including the choice of the option "No". After changing at least one value in the line, the button "Make changes" should appear / become active to the right of the line and the "Cancel" button Cancel button - cancels the changes entered, but not yet saved by the user (deletes the entered data and returns those that were before the input). the time has not been saved yet
3.1 Clicking on the "Make Changes" button does the following:
*The assigned time is the time that is currently being saved in the graph (table), it may be equal to the already assigned one, if, for example, only the on time has been changed, but the off time has not been changed (or vice versa). However, for simplicity of setting the problem, we consider that both times are saved, and not just the one that was changed.
3.1.1. Check that the scheduled turn-on time is at least 1 hour after the scheduled turn-off time on the same date. Consider the option "No" for the switch-off time.
3.1.2. Check that the scheduled switch-off time is at least 1 hour after the scheduled switch-on time on the same date. Note the "No" option for the switch-on time.

3.2. If the checks in paragraphs 3.1.1, 3.1.2 were not successful, then you need to show an error. If successful, then you need to show a window like this:
"
Do you really want to change the schedule of the servers on 01.10.2015?
Old schedule: 08:00 - 20:00.
New schedule: 07:00 - 23:00.
"
Buttons: Yes and No.

No - return to editing the table.
Yes - go to point 3.3.

3.3. Check that the scheduled turn-on time is at least 5 minutes after the current server time. If not, throw an error.

3.4. Check that the scheduled shutdown time is at least 5 minutes after the current server time. If not, throw an error.

3.5. Check that the scheduled switch-off time is at least 1 hour before the next switch-on time already assigned after it, even if the switch-on time is the next day. For example, it is not possible to assign an off time today at 23:45 if an on time is already assigned tomorrow at 00:15. If not, throw an error and return the user to editing the table.

3.6. Check that the scheduled switch-on time is at least one hour before the next switch-off time already assigned after it, even if the switch-off time is the next day. For example, it is not possible to set an on time for today at 23:45 if an off time is already set for tomorrow at 00:15. If not, throw an error.

3.7. Check if the schedule for that day has already been changed.

3.8. Change the time in the table and send a letter to a predetermined address with a text according to a predefined template like:
"
Irina Gaevaya changed the schedule of the servers on 01.10.2015.
New schedule: 07:00 - 23:00
Old schedule: 08:00 - 20:00

Viewing and changing the schedule is possible at the link: ...
"

4. Above the table, display the date and time of the nearest event in large font. Red - if it's a shutdown time. Green - if this is the turn-on time.

5. Above the table display the current date and time of the server.

6. Users of the Administrators group should be able to:
6.1. Set all the times that are indicated in paragraph 3.
6.2. Edit the message template that will be sent to users (clause 3.8).

7. If the authorized user has a member of the Administrators group in the domain, then the "Fill schedule" button should be available to him.
7.1. The "Fill schedule button" should ensure that the schedule is set to a given range of dates, with or without taking into account certain days of the week. For example, I want to set a schedule from 8:00 to 20:00 for the period from 03/01/2016 to 09/30/2016. I have to set the time, dates and select the days of the week for which I set this schedule (for example: Mon, Tue, Wed, Thu, Fri).

8. The schedule must be stored in a database. As an option - in Azure.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mark Doe, 2015-10-24
@mourr

Well, the most obvious option is to create a textbook, on the same google drive, from which PowerShell will drag and parse data using System.Net.WebRequest for example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question