Exploring Rubrik SLA Domains using Rubrik PowerShell Module

0

In my previous post, we looked at what a Rubrik SLA Domain is and how can it be created using the Rubrik HTML UI from any supported browser. And I also mentioned in that, we will be looking at creating the same using the Rubrik PowerShell Module. So, here we are.

The first and important thing to know is that Rubrik was built upon an API first architecture. What that means is anything that you can do from UI can easily be done using the APIs. In fact, any action that you perform on the UI ends up calling an API behind the scenes.

And what this has allowed us to do is to create various SDKs which are open-sourced and provided to the community to better interact with Rubrik CDM. And one such SDK for PowerShell is called Rubrik SDK for PowerShell.

The entire documentation for the project can be found here.

There are various ways that you can install the Rubrik PowerShell Module, but the easiest of all is to do from the PowerShell Gallery. Also, this module works with PowerShell core.

To install the module, type the below:

Install-Module -Name Rubrik -Scope CurrentUser

The next step is to load the module by using the Import-Module cmdlet.

Import-Module Rubrik

Now that the Rubrik PowerShell Module is installed, I'll connect to one of my test Rubrik clusters which can be done using the Connect-Rubrik cmdlet.

Connect-Rubrik <IP Address of a Rubrik node/Cluster FQDN>

Create Rubrik SLA Domain using Rubrik PowerShell Module
Every cmdlet that is part of the Rubrik PowerShell Module has "Rubrik" as part of the noun. This is to make sure that if you have any other vendor which has similar cmdlets, there is no confusion.

To list all the cmdlets available to either create, get, update or delete a Rubrik SLA Domain, type the below command.

Rubrik PowerShell Module
By looking at the output, it is clear that we will be using the New-RubrikSLA cmdlet to create the new SLA Domain.

We can also, run the Get-Help command against the cmdlet and look at the detailed information along with Examples and also online information.

Get-Help New-RubrikSLA -Examples

Get-Help New-RubrikSLA -Online

Alright, let us create the first SLA using the same basic example as my previous post:

  • Backup every Hour and retain for 1 day.
  • Backup every Day and retain for 30 days.
  • Backup every Month and retain for 12 months.
  • Backup every Year and retain for 3 years.

New-RubrikSLA -Name "API-SLA" -HourlyFrequency 1 -HourlyRetention 24 -DailyFrequency 1 -DailyRetention 30 -MonthlyFrequency 1 -MonthlyRetention 12 -YearlyFrequency 1 -YearlyRetention 3

Let us now use the Get-RubrikSLA cmdlet to check if the SLA Domain was created successfully or not.

$mySLA = Get-RubrikSLA -Name "API-SLA"

$mySLA.frequencies | fl *

Rubrik PowerShell Module

Now, let us update the SLA using the Set-RubrikSLA cmdlet and add the advanced config as below:

  • Backup every Hour and retain for 1 day.
  • Backup every Day and retain for 7 days.
  • Backup every Week on Sunday and retain for 4 weeks.
  • Backup every Month on the 1st and retain for 3 months.
  • Backup every Quarter in January and retain for 4 quarters.
  • Backup every Year on the First day of the year in January and retain for 3 years.

Set-RubrikSLA -id 3c134c26-c6ef-43d8-82b7-ac5defa4axxx -Name "API-SLA" -AdvancedConfig -HourlyFrequency 1 -HourlyRetention 1 -DailyFrequency 1 -DailyRetention 7 -WeeklyFrequency 1 -WeeklyRetention 4 -DayOfWeek Sunday -MonthlyFrequency 1 -MonthlyRetention 3 -DayOfMonth FirstDay -QuarterlyFrequency 1 -QuarterlyRetention 4 -DayOfQuarter FirstDay -FirstQuarterStartMonth January -YearlyFrequency 1 -YearlyRetention 3 -DayOfYear FirstDay -YearStartMonth January

Finally, this reflects using the Get-RubrikSLA as well.

SLA Domain using Rubrik PowerShell

Well, this brings us to the end of this post. We have successfully looked at creating, updating and getting the SLA Domain information using the Rubrik PowerShell module.

Stay tuned for more! I hope you find this informative and thank you for reading!

Share.

About Author

I am Adil Arif, working as a Senior Technical Support Engineer at Rubrik as well as an independent blogger and founder of Enterprise Daddy. In my current role, I am supporting infrastructure related to Windows and VMware datacenters.

Leave A Reply