Category Archives: Automation

Download and restore MS SQL database backup

databaseSchedulingIconIn this post I’ll show an example of simple automation task – we need to download 7z archive from SFTP, unzip it and restore the newest database automatically on a daily basics.

If we go bit deeper we’ll see a few more requirements:

  1. SFTP requires auth;
  2. 7z file is protected with password;
  3. We need to test every important step;
  4. We need to add permissions to a database;
  5. We can shrink transaction log to save some space;
  6. We we need to log every important step to EventLog;
  7. We want to get a nice report with time measures;

It’s clear now, so let’s get down to prerequisites.

Continue reading

Azure VMs turn off & on by schedule

save-timeIn this post I’ll show how to setup Azure VMs turn off & on by schedule using Azure Automation which is really useful for cost saving.

We’ll use dozen of actions to manage this task.

However, not all actions can be managed with PowerShell, so we’ll use old Azure portal a few times.

Initially I used one big script, but for this demo I decided to split it to make things simple.

In this particular example I’ll use two VMs running in the same cloud service.

Continue reading