Updated: February 1, 2025
PowerShell is a powerful tool for automating and extending the capabilities of Rubrik Security Cloud (RSC). While the RSC Console provides an intuitive interface for managing your data protection needs, PowerShell enables:
Operational Efficiency: Automate repetitive tasks and streamline workflows
Extended Capabilities: Perform actions not easily accessible via the UI
Unmatched Flexibility: If you can dream it, you can script it
The RubrikSecurityCloud PowerShell module empowers users to manage their Rubrik environment programmatically, unlocking the full potential of RSC.
Getting Started: Installation and Setup
To begin using the RubrikSecurityCloud module, install it from the PowerShell Gallery:
Install-Module -Name rubriksecuritycloud
If you encounter issues due to execution policy settings, run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Connecting to Rubrik Security Cloud
To authenticate with RSC using a service account, follow these steps:
Obtain a service account JSON file from Rubrik Security Cloud.
Use the json file to create an encrypted credential file. Set-RscServiceAccountFile will give you the option to delete the unencrypted json after the credential file is created.
Connect to RSC using PowerShell:
Set-RscServiceAccountFile -InputFilePath myServiceAccountFile.json
Connect-Rsc
Upon successful authentication, you’re ready to interact with RSC programmatically.
Getting Help and Exploring Available Commands
To explore the full range of available commands in the RubrikSecurityCloud module, use:
Get-Command -Module rubriksecuritycloud -CommandType Function
For detailed information on a specific command, such as Get-RscWorkload, use:
Get-Help Get-RscWorkload -Detailed
Compliance Reporting Use Case: Listing Workloads
This example helps administrators ensure data protection is in compliance with the assigned SLA Domain:
Get-RscWorkload -ComplianceStatus OUT_OF_COMPLIANCE -ComplianceTimeRange LAST_24_HOURS
This single command can list all workloads, their assigned SLA domains, the last snapshot timestamp, compliance status, storage usage, and more. Be sure to pipe to Format-List to see all the properties available on these workload objects:
Get-RscSla -Name "Gold-replicated" | Get-RscWorkload | Format-List
Assigning an SLA to an Object
To assign an SLA domain to a specific object (e.g., a VM, database, or fileset), use:
$workload = Get-RscVmwareVm -Name "MyVm" -Relic:$false -Replica:
$false
$sla = Get-RscSla -Name "Gold-replicated"
$workload | Protect-RscWorkload -Sla $sla
This ensures that the workload is protected according to your policy.
Taking an On-Demand Snapshot
Not all capabilities have a simple cmdlet (yet!), but using the API reference, you can still perform any API call through the module's .NET SDK binding as demonstrated in the below example.
For immediate protection, trigger an on-demand snapshot of a workload:
$workload = Get-RscVmwareVm -Name "MyVm" -Relic:$false
-Replica:$false
$query = New-RscMutation -GqlMutation vsphereBulkOnDemandSnapshot
-FieldProfile FULL
$query.var.input = Get-RscType -Name
vsphereBulkOnDemandSnapshotInput
$query.var.input.config = Get-RscType -Name
BulkOnDemandSnapshotJobConfigInput
$query.var.input.config.Vms = @($workload.id)
$query.var.input.config.SlaId = $workload.EffectiveSlaDomain.Id
$result = Invoke-Rsc $query
This command initiates a snapshot, ensuring data is securely backed up.
Conclusion
The RubrikSecurityCloud PowerShell module provides a powerful way to interact with Rubrik Security Cloud beyond what’s available in the UI. Whether it’s automating compliance reporting, assigning SLA policies, or taking on-demand snapshots, PowerShell enables greater flexibility and efficiency.
Start leveraging PowerShell today and take your Rubrik Security Cloud operations to the next level!