preserver version of definition.pbir

This commit is contained in:
RuiRomano 2024-06-12 09:54:22 +01:00
Родитель 942285ec9d
Коммит 2adc0a0ba9
1 изменённых файлов: 54 добавлений и 28 удалений

Просмотреть файл

@ -131,7 +131,6 @@ Function Invoke-FabricAPIRequest {
[Parameter(Mandatory = $false)] [string] $contentType = "application/json; charset=utf-8", [Parameter(Mandatory = $false)] [string] $contentType = "application/json; charset=utf-8",
[Parameter(Mandatory = $false)] [int] $timeoutSec = 240, [Parameter(Mandatory = $false)] [int] $timeoutSec = 240,
[Parameter(Mandatory = $false)] [int] $retryCount = 0 [Parameter(Mandatory = $false)] [int] $retryCount = 0
) )
if ([string]::IsNullOrEmpty($authToken)) { if ([string]::IsNullOrEmpty($authToken)) {
@ -721,22 +720,36 @@ Function Import-FabricItems {
if ($datasetReference) if ($datasetReference)
{ {
$datasetName = $datasetReference.name # $datasetName = $datasetReference.name
$datasetId = $datasetReference.id $datasetId = $datasetReference.id
$newPBIR = @{ $pbirJson.datasetReference.byPath = $null
"version" = "1.0"
"datasetReference" = @{ $pbirJson.datasetReference.byConnection = @{
"byConnection" = @{ "connectionString" = $null
"connectionString" = $null "pbiServiceModelId" = $null
"pbiServiceModelId" = $null "pbiModelVirtualServerName" = "sobe_wowvirtualserver"
"pbiModelVirtualServerName" = "sobe_wowvirtualserver" "pbiModelDatabaseName" = "$datasetId"
"pbiModelDatabaseName" = "$datasetId" "name" = "EntityDataSource"
"name" = "EntityDataSource" "connectionType" = "pbiServiceXmlaStyleLive"
"connectionType" = "pbiServiceXmlaStyleLive" }
}
} $newPBIR = $pbirJson | ConvertTo-Json
} | ConvertTo-Json
# $newPBIR = @{
# "version" = "1.0"
# "datasetReference" = @{
# "byConnection" = @{
# "connectionString" = $null
# "pbiServiceModelId" = $null
# "pbiModelVirtualServerName" = "sobe_wowvirtualserver"
# "pbiModelDatabaseName" = "$datasetId"
# "name" = "EntityDataSource"
# "connectionType" = "pbiServiceXmlaStyleLive"
# }
# }
# } | ConvertTo-Json
$fileContent = [system.Text.Encoding]::UTF8.GetBytes($newPBIR) $fileContent = [system.Text.Encoding]::UTF8.GetBytes($newPBIR)
@ -950,20 +963,33 @@ Function Import-FabricItem {
{ {
throw "Cannot import directly a report using byPath connection. You must first resolve the semantic model id and pass it through the 'itemProperties' parameter." throw "Cannot import directly a report using byPath connection. You must first resolve the semantic model id and pass it through the 'itemProperties' parameter."
} }
$pbirJson.datasetReference.byPath = $null
$pbirJson.datasetReference.byConnection = @{
"connectionString" = $null
"pbiServiceModelId" = $null
"pbiModelVirtualServerName" = "sobe_wowvirtualserver"
"pbiModelDatabaseName" = "$datasetId"
"name" = "EntityDataSource"
"connectionType" = "pbiServiceXmlaStyleLive"
}
$newPBIR = $pbirJson | ConvertTo-Json
$newPBIR = @{ # $newPBIR = @{
"version" = "1.0" # "version" = "1.0"
"datasetReference" = @{ # "datasetReference" = @{
"byConnection" = @{ # "byConnection" = @{
"connectionString" = $null # "connectionString" = $null
"pbiServiceModelId" = $null # "pbiServiceModelId" = $null
"pbiModelVirtualServerName" = "sobe_wowvirtualserver" # "pbiModelVirtualServerName" = "sobe_wowvirtualserver"
"pbiModelDatabaseName" = "$datasetId" # "pbiModelDatabaseName" = "$datasetId"
"name" = "EntityDataSource" # "name" = "EntityDataSource"
"connectionType" = "pbiServiceXmlaStyleLive" # "connectionType" = "pbiServiceXmlaStyleLive"
} # }
} # }
} | ConvertTo-Json # } | ConvertTo-Json
$fileContent = [system.Text.Encoding]::UTF8.GetBytes($newPBIR) $fileContent = [system.Text.Encoding]::UTF8.GetBytes($newPBIR)
} }