clumnah / Operationalize-MSSQL-Backups-With-Rubrik-Security-Cloud

Operationalize MSSQL Backups With Rubrik Security Cloud
1 stars 1 forks source link

MSSQL Live Mount #1

Open k-laughman opened 7 months ago

k-laughman commented 7 months ago

Hi Chris,

In testing this out today, I hit issues with the actual Live Mount command using the README. I don't know if the array is to be called or the variable has to have the same name, but the following errors hit me up. Should this be an array or a variable passed to the NewRscMssqlLiveMount cmdlet?

I have tried a few ways with variables, manually, etc., and haven't gotten it to work yet. Ironically I am also getting a 500 error when I do it through the Rubrik Playground as well with the same values and no syntax errors that are highlighted in the playground.

PS C:\Program Files\WindowsPowerShell\Modules\RubrikSecurityCloud\0.26\net472> echo $TGTMssqlLiveMount

Name                           Value
----                           -----
TargetMssqlInstance            RubrikSecurityCloud.Types.MssqlInstance
MountedDatabaseName            graphql
RscMssqlDatabase               RubrikSecurityCloud.Types.MssqlDatabase
RecoveryDateTime               2024-03-14T20:45:02.000Z

PS C:\Program Files\WindowsPowerShell\Modules\RubrikSecurityCloud\0.26\net472> New-RscMssqlLiveMount $TGTMssqlLiveMount
New-RscMssqlLiveMount : Cannot process argument transformation on parameter 'RscMssqlDatabase'. Cannot create object of type "RubrikSecurityCloud.Types.MssqlDatabase". The TargetMssqlInstance
property was not found for the RubrikSecurityCloud.Types.MssqlDatabase object. The available property is: [AuthorizedOperations
<System.Collections.Generic.List`1[[RubrikSecurityCloud.Types.Operation, RubrikSecurityCloud.Schema, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]>] , [ObjectType
<System.Nullable`1[[RubrikSecurityCloud.Types.HierarchyObjectTypeEnum, RubrikSecurityCloud.Schema, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]>] , [SlaAssignment
<System.Nullable`1[[RubrikSecurityCloud.Types.SlaAssignmentTypeEnum, RubrikSecurityCloud.Schema, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]>] , [ConfiguredSlaDomain
<RubrikSecurityCloud.Types.SlaDomain>] , [EffectiveRetentionSlaDomain <RubrikSecurityCloud.Types.SlaDomain>] , [EffectiveSlaDomain <RubrikSecurityCloud.Types.SlaDomain>] , [PendingSla
<RubrikSecurityCloud.Types.SlaDomain>] , [ReplicatedObjects <System.Collections.Generic.List`1[[RubrikSecurityCloud.Types.CdmHierarchyObject, RubrikSecurityCloud.Schema, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null]]>] , [CdmId <System.String>] , [CdmLink <System.String>] , [CdmOnDemandSnapshotCount <System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [CopyOnly <System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [DagId
<System.String>] , [HasLogConfigFromSla <System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [HasPermissions
<System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [HostLogRetention <System.Nullable`1[[System.Int64, mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [Id <System.String>] , [IsInAvailabilityGroup <System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [IsLogShippingSecondary <System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]>] , [IsMount <System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [IsOnline
<System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [IsRelic <System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [LogBackupFrequencyInSeconds <System.Nullable`1[[System.Single, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]>] , [LogBackupRetentionInHours <System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [Name
<System.String>] , [NumWorkloadDescendants <System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [OnDemandSnapshotCount
<System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [PostBackupScript <System.String>] , [PreBackupScript <System.String>] ,
[RecoveryModel <System.String>] , [ReplicatedObjectCount <System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [SlaPauseStatus
<System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [UnprotectableReasons <System.Collections.Generic.List`1[[System.String,
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] , [AllOrgs <System.Collections.Generic.List`1[[RubrikSecurityCloud.Types.Org, RubrikSecurityCloud.Schema,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]>] , [CdmGroupedSnapshots <RubrikSecurityCloud.Types.CdmGroupedSnapshotConnection>] , [CdmNewestSnapshot
<RubrikSecurityCloud.Types.CdmWorkloadSnapshot>] , [CdmOldestSnapshot <RubrikSecurityCloud.Types.CdmWorkloadSnapshot>] , [CdmSnapshots
<RubrikSecurityCloud.Types.CdmWorkloadSnapshotConnection>] , [Cluster <RubrikSecurityCloud.Types.Cluster>] , [EffectiveSlaSourceObject <RubrikSecurityCloud.Types.PathNode>] , [LatestUserNote
<RubrikSecurityCloud.Types.LatestUserNote>] , [LiveMounts <RubrikSecurityCloud.Types.MssqlDatabaseLiveMountConnection>] , [LogicalPath
<System.Collections.Generic.List`1[[RubrikSecurityCloud.Types.PathNode, RubrikSecurityCloud.Schema, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]>] , [MissedSnapshotConnection
<RubrikSecurityCloud.Types.MissedSnapshotCommonConnection>] , [MissedSnapshotGroupByConnection <RubrikSecurityCloud.Types.MissedSnapshotGroupByConnection>] , [NewestArchivedSnapshot
<RubrikSecurityCloud.Types.CdmSnapshot>] , [NewestIndexedSnapshot <RubrikSecurityCloud.Types.CdmSnapshot>] , [NewestReplicatedSnapshot <RubrikSecurityCloud.Types.CdmSnapshot>] ,
[NewestSnapshot <RubrikSecurityCloud.Types.CdmSnapshot>] , [OldestSnapshot <RubrikSecurityCloud.Types.CdmSnapshot>] , [PendingObjectDeletionStatus
<RubrikSecurityCloud.Types.PendingSnapshotsOfObjectDeletion>] , [PhysicalPath <System.Collections.Generic.List`1[[RubrikSecurityCloud.Types.PathNode, RubrikSecurityCloud.Schema,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]>] , [PrimaryClusterLocation <RubrikSecurityCloud.Types.DataLocation>] , [Replicas
<System.Collections.Generic.List`1[[RubrikSecurityCloud.Types.CdmMssqlDbReplica, RubrikSecurityCloud.Schema, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]>] , [SnapshotConnection
<RubrikSecurityCloud.Types.CdmSnapshotConnection>] , [SnapshotDistribution <RubrikSecurityCloud.Types.SnapshotDistribution>] , [SnapshotGroupByConnection
<RubrikSecurityCloud.Types.CdmSnapshotGroupByConnection>] , [SnapshotGroupBySummary <RubrikSecurityCloud.Types.CdmSnapshotGroupBySummaryConnection>]
At line:1 char:23
+ New-RscMssqlLiveMount $TGTMssqlLiveMount
+                       ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [New-RscMssqlLiveMount], ParameterBindingArgumentTransformationException

Thanks

clumnah commented 7 months ago

When you output $RscMssqlInstance and/or $RscMssqlDatabase, how many records are returned with each? If either or both has more than one, then that is the problem.

k-laughman commented 7 months ago

Running the commands in the docs, each output has only 1 Instance/Database referenced in the output, but the output is not a single value, it is seemingly all of the schema info for that particular object. Here is the output of the two:

echo $SRCRscMssqlInstance

AuthorizedOperations        :
ObjectType                  : MSSQL_INSTANCE
SlaAssignment               : UNASSIGNED
ConfiguredSlaDomain         :
EffectiveRetentionSlaDomain :
EffectiveSlaDomain          : RubrikSecurityCloud.Types.GlobalSlaReply
PendingSla                  :
ReplicatedObjects           :
HasLogConfigFromSla         : True
HostLogRetention            :
Id                          : 97a5e21b-70c6-5ac7-8e5b-2fc28a7f4eba
LogBackupFrequencyInSeconds :
LogBackupRetentionInHours   :
Name                        : MSSQLSERVER
NumWorkloadDescendants      : 10
ReplicatedObjectCount       :
SlaPauseStatus              : False
UnprotectableReasons        :
AllOrgs                     :
Cluster                     :
DescendantConnection        :
EffectiveSlaSourceObject    :
LatestUserNote              :
LogicalChildConnection      :
LogicalPath                 :
PendingObjectDeletionStatus :
PhysicalPath                :
PrimaryClusterLocation      :
SnapshotDistribution        :
echo $SRCRscMssqlDatabase

AuthorizedOperations            :
ObjectType                      : MSSQL
SlaAssignment                   : DIRECT
ConfiguredSlaDomain             :
EffectiveRetentionSlaDomain     :
EffectiveSlaDomain              : RubrikSecurityCloud.Types.ClusterSlaDomain
PendingSla                      :
ReplicatedObjects               :
CdmId                           : dc4db47c-cf50-433d-85c7-7d3308e61f71
CdmLink                         :
CdmOnDemandSnapshotCount        :
CopyOnly                        : False
DagId                           : 0b4de0ce-e2fd-5c10-944c-6cfc88a87c12
HasLogConfigFromSla             : True
HasPermissions                  : True
HostLogRetention                : -1
Id                              : c093d939-e359-5c90-b962-d28ebf0a057a
IsInAvailabilityGroup           : False
IsLogShippingSecondary          : False
IsMount                         : False
IsOnline                        : True
IsRelic                         : False
LogBackupFrequencyInSeconds     : -2
LogBackupRetentionInHours       : -3
Name                            : db_cs_horizon
NumWorkloadDescendants          : 0
OnDemandSnapshotCount           :
PostBackupScript                :
PreBackupScript                 :
RecoveryModel                   :
ReplicatedObjectCount           :
SlaPauseStatus                  : False
UnprotectableReasons            :
AllOrgs                         :
CdmGroupedSnapshots             :
CdmNewestSnapshot               :
CdmOldestSnapshot               :
CdmSnapshots                    :
Cluster                         :
EffectiveSlaSourceObject        :
LatestUserNote                  :
LiveMounts                      :
LogicalPath                     :
MissedSnapshotConnection        :
MissedSnapshotGroupByConnection :
NewestArchivedSnapshot          :
NewestIndexedSnapshot           :
NewestReplicatedSnapshot        :
NewestSnapshot                  :
OldestSnapshot                  :
PendingObjectDeletionStatus     :
PhysicalPath                    : {MSSQLSERVER, vm-01.local}
PrimaryClusterLocation          :
Replicas                        :
SnapshotConnection              :
SnapshotDistribution            :
SnapshotGroupByConnection       :
SnapshotGroupBySummary          :

Is that output the output expected? Is there possibly a manual example to piece these together that might work as an alternative?

Thanks.

clumnah commented 7 months ago

I have been looking into this via a separate issue. I am not sure why the data is being returned as an Array vs the specific database type. I am working with some people internally to figure out next steps.

clumnah commented 7 months ago

I have found this issue and have put in a fix for it. Unfortunately, I did not make it into .29 that got released yesterday. It will be in the following release. Once it hits .30 you should be able to test and see this work as expected now.

k-laughman commented 7 months ago

Thanks! I will standby for .30 next week and retry and post my results here to either close the case or troubleshoot further.