Snapshot automation with Power Automate

In this series of ‘how to’ blogs, we take a deep dive into the more technical aspects of our platform and how to use them. Using Power Automate is one of the scenarios for creating snapshots but not the most preferred. We just want to show you the capabilities of our API in combination with Power Automate.

On 23/02/2022 we released hourly snapshots in our VCO portal interface.

The challenge

Scheduling your own snapshots as an addition to the snapshot features on the whitesky.cloud platform.

The solution

A basic sample of how to automate snapshots. You can always get more creative. 

Requirements

In order to replicate this feature, you will need Power Automate. As some of our customers use Power Automate on a regular basis, we took on the challenge to create a workflow that uses our API. The API documentation can be found in our portal. 

Deep dive into our API

If you haven’t checked out our API yet, now is the time!

If you want to use our API using external applications or tools like Power Automate, Zapier or Integromat you need to have a JWT token for authentication. You can find that token after login on the whitesky.cloud portal. On the screenshot below you can find its location. 

When you select the API option on the sidebar you will be taken to the following screen.

There you can get the token you need. Select the copy jwt option. This will copy the token to your clipboard.

Note

There are two things to keep in mind when using the token:

  • keep it safe and private, don’t share it
  • the token will be refreshed occasionally

Once you’ve copied the token you can explore our API.

On the API page you can find all of our API calls and methods. Make sure to select customers, after clicking you will see the full list of available API’s.

Do a page search for snapshots and you will see the desired API to use. Choose the POST method to expand all information.

As you can see, some parameters are mandatory, we will use these in Power Automate later on.

Starting Power Automate

Power Automate is part of the Microsoft toolset, you can find it here. For this process, we assume you are familiar with Power Automate.

In our dashboard you can see we have a previously created flow called automatic snapshots. Here’s how to set it up. 

Our flow contains 9 steps including step 1, automatic scheduling.

Recurrence interval

The recurrence interval is used to determine how many times the flow runs. You can set this to your own needs. 

Initialise variable for token

Make sure to initialise this step with the valid token which you copied to the clipboard earlier on. Paste the token in the value field.

Initialise variable for customer_id

You need to supply the customer_id to make the API call valid. This id can be found in the browser address bar.

Initialise the variable for location

Snapshots can be created for any location a customer has access to. The location id can be found in the whitesky.cloud portal. Copy the location id and paste it into the value field of the Power Automate step. 

Initialise the variable disk id

To save your snapshot to the correct location, you need to specify the disk where it needs to be stored. In order to do that you need the disk id which can be copied from the portal.

Go to the overview of your cloudspaces, pick a cloudspace and select a VM. After selecting a VM, the VM disks will show, most times this will be a boot disk and a data disk. If you don’t have a data disk yet, we advise you to create one.

Copy the disk id, make sure to copy the id as shown in the screenshot below.

When copied make sure to use it as the value in the Power Automate step.

Set snapshot name

The next thing you need to configure is the snapshot name, choose a name which follows our naming routine.

After defining the variables it is important to make sure the authentication token is refreshed.

Call snapshot API

The last step in the Power Automate flow is to call the snapshot endpoint with all supplied parameters.

If all parameters and settings are correct you can check the portal to see if you succeeded in making a snapshot.

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
LOGIN

Don’t have an account yet? Register and we’ll grant you access to our marketing and sales assets!