The Rubrik PowerShell Module was built to make it easy for users to use both scripted automation and command-line interaction with Rubrik. As the Rubrik Cloud Data Management (CDM) platform continues to evolve, we are committed to keeping the development of the PowerShell module in lockstep. In this blog post, I will explore a number of recently released features of the Rubrik PowerShell module that allow for better integration and direct interaction through GraphQL, as well as various quality-of-life improvements, such as customization of existing cmdlets and the ability to securely specify a default set of credentials for authentication.
Setting Custom Module Options
Users can now customize the Rubrik module with the Set-RubrikModuleDefaultParameter and Set-RubrikModuleOption cmdlets.
These cmdlets write to a json configuration file stored in the user’s home directory, which reads the configuration the moment the module is loaded and settings are changed. Set-RubrikModuleDefaultParameter sets default parameter settings for all cmdlets in the Rubrik module, a PowerShell functionality powered by the automatic $PSDefaultParameters variable. Set-RubrikModuleOption sets options such as default credentials, default timeout of API requests, and enablement of custom view definitions.
The following example shows how to use the Remove-RubrikDefaultParameter cmdlet to remove the default setting in which all queries that do not have -PrimaryClusterId set only return results on the current cluster. By removing this default, any Get-* cmdlet will retrieve objects from all connected clusters.
Download Files from the Rubrik Cluster
Another new use case for the module is the ability to download filesets directly from the Rubrik cluster using a combination of the Get-RubrikDownloadLink cmdlet and Start-RubrikDownload. For examples, a user could take multiple backup snapshots from different dates and download the data. They can then use this data to establish which backup at a specific date contains the data that needs to be retrieved. This is especially useful when dealing with large filesets with many potential recovery points in time.
Now, let’s walk through how to use Get-RubrikFileSet, Get-RubrikSnapshot, and Start-RubrikDownload to easily download a complete fileset or a subset of a fileset. The following examples shows how to download the \marketing folder that is part of the fileset:
Start-RubrikDownload and Get-RubrikDownloadLink can also be used to download a variety of other objects from the Rubrik Cluster and serve as a tool to further simplify downloading data from Rubrik.
Perform GraphQL Queries Using the Module
Most of the queries in the module are through our various RESTful API endpoints. We do, however, also have the ability to perform API queries with our GraphQL service. This offers the benefits of GraphQL, such as more specific queries and the ability to return only certain fields and to return required information with a single query against a single service.
For example, if users want to know the number of protected and unprotected VMs known to the Rubrik Cluster, this would be hard to establish using the RESTful API endpoints. Using the GraphQL service, this can be retrieved with a single query:
It is also possible to construct more advanced queries to utilize the full potential of our GraphQL service.
Connect to Rubrik Cluster with Default Set of Credentials
When you connect to multiple Rubrik clusters or multiple organizations, it can be tedious to enter in credentials every time you authenticate against a new cluster. The Rubrik module has an option to specify a default credential if no credentials already are. This works by first creating a saved credential file on your system and configuring the module to use these as the default credentials:
Now that this has been configured, it is possible to connect directly with Rubrik–no credential, token or user name, or password required. The following example shows this in action:
We are always eager to learn what other features or enhancements people would like to see. To date, we have taken in several hundreds bug reports and feature requests and implemented these in the module. If you have any suggestions we are always open to feedback and suggestions:
GitHub – Rubrikinc – Rubrik SDK for PowerShell – New Issue
If you would like to learn more about the Rubrik PowerShell Module, we have extensive documentation available on GitHub:
PowerShell Module – Documentation
Can’t find what you are looking for, or the command you want is not there yet? While we try to have a broad coverage of functionality, not everything has been created yet. You can help us by posting your bug reports, feedback and suggestions in our GitHub repository or by contributing to the PowerShell module.