rubrikinc / rubrik-sdk-for-powershell

Rubrik Module for PowerShell
https://build.rubrik.com/sdks/powershell/
MIT License
102 stars 87 forks source link

New-RubrikSnapShot is not working to create a Snapshot of an MSSQL Database that we are backing up #859

Open JediMaster12 opened 2 days ago

JediMaster12 commented 2 days ago

Current Behavior

I am able to do the connection piece to Rubrik no problem and I am able to successfully run New-RubrikLogBackup.  I am connecting with an API Key.

This is going to be used to take a snapshot of a database as part of a pipeline, if the deployment fails the snapshot will be used to restore the Database back to where it was at the time of backup.

Rubrik Module Version
Module version 9.0.1
################
PowerShell Version
Name                           Value                                                                                                                                                                                                                                                                                                                              
----                           -----                                                                                                                                                                                                                                                                                                                              
PSVersion                      5.1.17763.6292                                                                                                                                                                                                                                                                                                                     
PSEdition                      Desktop                                                                                                                                                                                                                                                                                                                            
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                                                                                                                                                            
BuildVersion                   10.0.17763.6292                                                                                                                                                                                                                                                                                                                    
CLRVersion                     4.0.30319.42000                                                                                                                                                                                                                                                                                                                    
WSManStackVersion              3.0                                                                                                                                                                                                                                                                                                                                
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                                                                                                                                                
SerializationVersion           1.1.0.1  
####################

New-RubrikSnapshot -id $RubrikDatabase.id -SLA $RubrikDatabase.effectiveSlaDomainName -Verbose
VERBOSE: Validate the Rubrik token exists
VERBOSE: Found a Rubrik token for authentication
VERBOSE: Gather API Data for New-RubrikSnapshot
VERBOSE: Selected 5.3 API Data for New-RubrikSnapshot
VERBOSE: Load API data for New-RubrikSnapshot
VERBOSE: Description: Create an on-demand snapshot for the given object ID
VERBOSE: Determining the SLA Domain id
VERBOSE: Validate the Rubrik token exists
VERBOSE: Found a Rubrik token for authentication
VERBOSE: Gather API Data for Get-RubrikSLA
VERBOSE: Selected 5.0 API Data for Get-RubrikSLA
VERBOSE: Load API data for Get-RubrikSLA
VERBOSE: Description: Retrieve summary information for all SLA Domains
VERBOSE: Build the URI
VERBOSE: URI = https://x.xxx.xxx.xx/api/v2/sla_domain
VERBOSE: Build the query parameters for primary_cluster_id
VERBOSE: URI = https://x.xxx.xxx.xx/api/v2/sla_domain?primary_cluster_id=local
VERBOSE: Submitting the request
VERBOSE: Invoking request with a custom timeout of 100 seconds
VERBOSE: GET https://x.xxx.xxx.xx/api/v2/sla_domain?primary_cluster_id=local with 0-byte payload
VERBOSE: received 14472-byte response of content type application/json
VERBOSE: Received HTTP Status 200
VERBOSE: Formatting return value
VERBOSE: Filter the results
VERBOSE: Filter match = 'Name' with value = 'AH_Prod_SQL (Managed by Polaris)'
VERBOSE: Getting SLA Domain frequency summary
VERBOSE: Advanced config found, using this
VERBOSE: Applying Rubrik.SLADomain TypeName to results
VERBOSE: Multiple URIs detected. Selecting URI based on MssqlDatabase:::xxxxxxxx-8247-4c28-91fa-761500473edf
VERBOSE: Loading MSSQL API data
VERBOSE: List of set parameters: [id, MssqlDatabase:::xxxxxxxx-8247-4c28-91fa-761500473edf] [SLA, AH_Prod_SQL (Managed by Polaris)] [Verbose, True] [SLAID, xxxxxxxx-c851-47d
c-a7c2-8f212863c671]
VERBOSE: Build the body parameters
VERBOSE: Adding forceFullSnapshot...
VERBOSE: Adding slaId...
VERBOSE: Body = {
    "slaId":  "xxxxxxxx-c851-47dc-a7c2-8f212863c671"
}
VERBOSE: https://x.xxx.xxx.xx/api/v1/mssql/db/MssqlDatabase:::xxxxxxxx-8247-4c28-91fa-761500473edf/snapshot
VERBOSE: Submitting the request
VERBOSE: Submitting "Post" request as "text/plain; charset=utf-8"
VERBOSE: Invoking request with a custom timeout of 100 seconds
VERBOSE: POST https://x.xxx.xxx.xx/api/v1/mssql/db/MssqlDatabase:::xxxxxxxx-8247-4c28-91fa-761500473edf/snapshot with -1-byte payload
Invoke-WebRequest : The request was a legal request, but the server is refusing to respond to it.
At C:\Program Files\WindowsPowerShell\Modules\Rubrik\9.0.1\Private\Invoke-RubrikWebRequest.ps1:46 char:23
+ ...   $result = Invoke-WebRequest -UseBasicParsing -TimeoutSec $rubrikOpt ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Expected Behavior

Create a Snapshot of the Database at the time the command is issued.

Steps to Reproduce

  1. On-Prem version of Rubrik running
  2. We have to connect directly to a cluster (node?) not the IP where we login to the web gui
  3. Connect with an API Key using Windows PowerShell ISE
  4. Run A command like this Get-RubrikDatabase -Name 'DB1' | New-RubrikSnapshot -SLA 'GOLD'

Context

Get-RubrikDebugInfo

PSVersion                     : 5.1.17763.6292
PSEdition                     : Desktop
PSCompatibleVersions          : {1.0, 2.0, 3.0, 4.0...}
BuildVersion                  : 10.0.17763.6292
CLRVersion                    : 4.0.30319.42000
WSManStackVersion             : 3.0
PSRemotingProtocolVersion     : 2.3
SerializationVersion          : 1.1.0.1
HostConsoleName               : Windows PowerShell ISE Host
HostConsoleVersion            : 5.1.17763.6292
HostCulture                   : en-US
HostCultureUI                 : en-US
RubrikConnection              : True
UserAgentString               : RubrikPowerShellSDK-9.0.1--5.1.17763.6292--platform--Win32NT--platform_version--Microsoft Windows Server 2019 Standard17763
RubrikAuthentication          : Bearer
RubrikClusterVersion          : 8.1.3-p13-25544
RubrikCurrentModuleVersion    : 9.0.1
RubrikInstalledModule         : 9.0.1
RubrikModuleOptions           : ApplyCustomViewDefinitions = True; CredentialPath = ; DefaultWebRequestTimeOut = 100
RubrikModuleDefaultParameters : 

PS C:\Users\ADJCR> $RubrikServer = (Get-Secret -Name RubrikServer -AsPlainText)
$Token = (Get-Secret -Name RubrikAPIKey -AsPlainText)
Connect-Rubrik -Server $RubrikServer -Token $Token

Name                           Value                                                                                                                                        
----                           -----                                                                                                                                        
authType                       Token                                                                                                                                        
api                            1                                                                                                                                            
id                                                                                                                                                                          
server                         xx.xxx.x.xx
version                        8.1.3-p13-25544                                                                                                                              
header                         {User-Agent, Authorization}                                                                                                                  
time                           10/9/2024 2:50:59 PM                                                                                                                         
userId                         af300dd3-xxxx-xxxx-b55e-27d919ae4eb6_xxxxxx[LDAP:xxxxxxx]

Failure Logs

`Invoke-WebRequest : The request was a legal request, but the server is refusing to respond to it. At C:\Program Files\WindowsPowerShell\Modules\Rubrik\9.0.1\Private\Invoke-RubrikWebRequest.ps1:46 char:23

JediMaster12 commented 17 hours ago

@mwpreston any thoughts on how to resolve this?