rubrik-sdk-for-powershell
rubrik-sdk-for-powershell copied to clipboard
Unable to assign a SLA to my VM
Current Behavior
COMMENTAIRES : Validate the Rubrik token exists
COMMENTAIRES : Found a Rubrik token for authentication
COMMENTAIRES : Gather API Data for Protect-RubrikVM
COMMENTAIRES : Selected 5.2 API Data for Protect-RubrikVM
COMMENTAIRES : Load API data for Protect-RubrikVM
COMMENTAIRES : Description: Update a VM with the specified SLA Domain.
COMMENTAIRES : Build the URI
COMMENTAIRES : URI = https://xx.xx.xx.xx/api/v2/sla_domain/9002e8ef-4277-xxx/assign
COMMENTAIRES : Body = {
"managedIds": [
"VirtualMachine:::2db42ccf-939f-xxx"
],
"existingSnapshotRetention": "RetainSnapshots"
}
COMMENTAIRES : Submitting the request
COMMENTAIRES : Submitting "Post" request as "text/plain; charset=utf-8"
COMMENTAIRES : Invoking request with a custom timeout of 100 seconds
COMMENTAIRES : POST https://xx.xx.xx.xx/api/v2/sla_domain/9002e8ef-4277-xxx/assign with -1-byte payload
Invoke-WebRequest : The request was a legal request, but the server is refusing to respond to it.
Au caractère C:\Program Files\WindowsPowerShell\Modules\Rubrik\6.0.1\Private\Invoke-RubrikWebRequest.ps1:36 : 23
+ ... $result = Invoke-WebRequest -UseBasicParsing -TimeoutSec $rubrikOpt ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation : (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Expected Behavior
Apply the specific SLA to my VM. I use a Token to connect to my local cluster.
Steps to Reproduce
No response
Context
PSVersion : 5.1.17763.5458
PSEdition : Desktop
PSCompatibleVersions : {1.0, 2.0, 3.0, 4.0...}
BuildVersion : 10.0.17763.5458
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.5458
HostCulture : fr-CA
HostCultureUI : fr-CA
RubrikConnection : True
UserAgentString : RubrikPowerShellSDK-6.0.1--5.1.17763.5458--platform--Win32NT--platform_version--Microsoft Windows Server 2019 Datacenter17763
RubrikAuthentication : Bearer
RubrikClusterVersion : 9.0.2-p1-25268
RubrikCurrentModuleVersion : 6.0.1
RubrikInstalledModule : 6.0.1
RubrikModuleOptions : ApplyCustomViewDefinitions = True; CredentialPath = ; DefaultWebRequestTimeOut = 100
RubrikModuleDefaultParameters :
Failure Logs
No response
I used -SkipHttpErrorCheck to have more informations and gain this
VERBOSE: Invoking request with a custom timeout of 100 seconds VERBOSE: Requested HTTP/1.1 POST with 149-byte payload VERBOSE: Received HTTP/1.1 77-byte response of content type text/plain VERBOSE: Received HTTP Status 403 DEBUG: Raw Response content: HTTP/1.1 403 Forbidden Date: Tue, 12 Mar 2024 19:49:02 GMT Content-Type: text/plain; charset=UTF-8 Content-Length: 77
The request was a legal request, but the server is refusing to respond to it. ConvertFrom-Json: C:\Program Files\WindowsPowerShell\Modules\Rubrik\6.0.1\Private\Submit-Request.ps1:41 Line | 41 | … ConvertFrom-Json -InputObject $WebResult.Content | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Conversion from JSON failed with error: Unexpected character encountered while parsing value: T. Path '', line 0, position 0.
I get 403 Forbidden? I tried to connect through Toekn and Service Account, all with administrator role.
Hello, The reason for this failure is most like due to the following
- Your role based access controls do not allow you to assign an SLA, most likely not the case if you are using an Admin role.
- Your Rubrik cluster is now in RSC Managed Mode. This means operations like assigning an SLA to an object must be done via RSC. You can either do this via the UI, or you can look at our SDK for RSC https://github.com/rubrikinc/rubrik-powershell-sdk
Hope this helps.
RSC was the case! I did the coding with this other sdk and now it worked, thanks!
Closing this issue - Thanks @clumnah !