Действия по настройке SQL Server Reporting Services вручную

Важно!

Поддержка этой версии Service Manager завершена. Мы рекомендуем выполнить обновление до Service Manager 2022.

Во время развертывания сервера управления хранилищем данных Service Manager можно указать сервер, на котором будет развернута Microsoft SQL Server Reporting Services (SSRS). По умолчанию при установке выбран компьютер, на котором размещен сервер управления хранилища данных. Если вы укажете другой компьютер для размещения служб SSRS, вам будет предложено выполнить эту процедуру для подготовки сервера. Подготовка удаленного компьютера для размещения служб SSRS включает следующие этапы, которые подробно рассматриваются в данном разделе.

  • Скопируйте файл Microsoft.EnterpriseManagement.Reporting.Code.dll с установочного носителя Service Manager на компьютер, на котором размещаются службы SQL Server Reporting Services.

  • Добавление сегмента кода в файл конфигурации rssrvpolicy на компьютере, на котором размещены службы SSRS.

  • Добавление тега Extension в существующий сегмент Data в файле конфигурации rsreportserver на том же компьютере.

Если вы использовали экземпляр SQL Server по умолчанию, используйте windows Обозреватель для перетаскивания Microsoft.EnterpriseManagement.Reporting.Code.dll (который находится в папке Предварительные требования на установочном носителе Service Manager) в папку \Program Files\Microsoft SQL Server\MSRS13. MSSQLSERVER\Reporting Services\ReportServer\Bin на компьютере, где размещаются службы SSRS. Если вы не использовали экземпляр SQL Server по умолчанию, путь к требуемой папке — \Program Files\Microsoft SQL Server\MSRS13.<>INSTANCE_NAME\Reporting Services\ReportServer\Bin. В следующей процедуре используется имя экземпляра по умолчанию.

Копирование файла Microsoft.EnterpriseManagement.Reporting.Code.dll

Выполните указанные ниже действия.

  1. На компьютере, на котором будут размещаться удаленные службы SSRS, откройте проводник.

  2. Для SQL Server 2016 найдите папку \Program Files\Microsoft SQL Server\MSRS13. MSSQLSERVER\Reporting Services\ReportServer\Bin.

  3. Откройте второе окно проводника, найдите диск с установочным носителем Service Manager и откройте на нем папку "Prerequisites".

  4. В папке Необходимые компоненты выберите Microsoft.EnterpriseManagement.Reporting.Code.dllи перетащите его в папку, расположенную на любом шаге 2.

Добавление сегмента кода в файл rssrvpolicy.config

Выполните указанные ниже действия.

  1. На компьютере, где будут размещаться службы SSRS, найдите файл rssrvpolicy.config в папке \Program Files\Microsoft SQL Server\MSRS13. Папка MSSQLSERVER\Reporting Services\ReportServer для SQL Server 2016.

  2. Используя любой редактор XML (например, Блокнот), откройте файл rssrvpolicy.config.

  3. Просмотрите файл и найдите сегменты кода <CodeGroup>. Ниже приведен пример сегмента кода <CodeGroup>.

    <CodeGroup
       class="UnionCodeGroup"
       version="1"
       PermissionSetName="FullTrust">
       <IMembershipCondition
          class="UrlMembershipCondition"
          version="1"
          Url="$CodeGen$/*"
       />
    </CodeGroup>
    
  4. Добавьте следующий сегмент <CodeGroup> целиком в тот же раздел, где расположены другие сегменты <CodeGroup>.

    <CodeGroup
       class="UnionCodeGroup"
       version="1"
       PermissionSetName="FullTrust"
       Name="Microsoft System Center Service Manager Reporting Code Assembly"
       Description="Grants the SCSM Reporting Code assembly full trust permission.">
       <IMembershipCondition
          class="StrongNameMembershipCondition"
          version="1"
          PublicKeyBlob="0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9"
    />
    </CodeGroup>
    
  5. Сохраните изменения и закройте редактор XML.

Добавление тега расширения в сегмент данных в файле rsreportserver.conf

Выполните указанные ниже действия.

  1. На компьютере с SSRS найдите файл rsreportserver.config в папке \Program Files\Microsoft SQL Server\MSRS13. Папка MSSQLSERVER\Reporting Services\ReportServer для SQL Server 2016.

  2. Используя любой редактор XML (например, Блокнот), откройте файл rsreportserver.config.

  3. Прокрутите содержимое файла rsreportserver.config и найдите сегмент кода <Data>. В этом файле есть только один <Data> сегмент кода.

  4. Добавьте следующий тег Extension в сегмент кода <Data>, где размещаются все остальные теги Extension:

    <Extension Name="SCDWMultiMartDataProcessor" Type="Microsoft.EnterpriseManagement.Reporting.MultiMartConnection, Microsoft.EnterpriseManagement.Reporting.Code" />
    
  5. Сохраните изменения и закройте редактор XML.

Проверка установки служб SSRS

В Service Manager Data Warehouse (DW) версии 2016 и более поздних наблюдается следующая известная проблема:

В Service Manager Data Warehouse (DW) наблюдается следующая известная проблема:

Если SQL Server Reporting Services (SSRS) выполняется локально на сервере управления Data Warehouse, а служба SSRS имеет версию 2017 или более позднюю версию, программа установки Data Warehouse успешно завершается, но может не настроить указанный локальный экземпляр SSRS должным образом.

Используйте приведенный ниже скрипт, чтобы проверить, правильно ли настроена установка локальных служб SSRS и может ли использоваться с Service Manager Data Warehouse.

Примечание

Этот сценарий PowerShell можно выполнить после установки Service Manager Data Warehouse. Скрипт не вносит никаких изменений в конфигурацию, но проверяет ее. Скрипт можно запускать столько раз, сколько потребуется.

#region function definitions

function SelfElevate() {
    #got from http://www.expta.com/2017/03/how-to-self-elevate-powershell-script.html   and changed a bit
    if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
     if ([int](Get-WmiObject -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
      $CommandLine = "-File `"" + $Script:MyInvocation.MyCommand.Path + "`" " + $Script:MyInvocation.UnboundArguments
      Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
      Exit
     }
    }
}
function EndScriptExecution() {
    Write-Host ""
    Read-Host "Press ENTER to stop execution" 
    Exit
}
#endregion
#region Init
SelfElevate
#endregion 

#region Select SSRS service
$ssrsServicesAvailable = gwmi win32_service | ?{ $_.DisplayName -like 'SQL Server Reporting Services*' }
if ($ssrsServicesAvailable -eq $null) {
    Write-Host "No SSRS service(s) detected on this machine. " -NoNewline
    Write-Host "Aborting ..." -ForegroundColor Yellow
    EndScriptExecution
}

if ( ($ssrsServicesAvailable | Measure-Object).Count -eq 1) {
    $ssrsServiceToVerify = ($ssrsServicesAvailable | Select-Object -Property DisplayName, State, PathName) | Select-Object -First 1
}
else {
    $ssrsServiceToVerify = $ssrsServicesAvailable | Select-Object -Property DisplayName, State, PathName | Out-GridView  -Title 'Select the SSRS service to verify and then click OK...' -OutputMode Single
    if ($ssrsServiceToVerify -eq $null) {
        Write-Host "No SSRS service selected to verify. " -NoNewline
        Write-Host "Aborting ..." -ForegroundColor Yellow
        EndScriptExecution
    }
}
#endregion

#region Preparation
Write-Host "--------------------------------------------------------------------"
Write-Host "Verifiying selected SSRS service : " -NoNewline
Write-Host "'$($ssrsServiceToVerify.DisplayName)'"  -ForegroundColor Cyan
Write-Host "--------------------------------------------------------------------"
Write-Host ""

$ssrsExePath = $ssrsServiceToVerify.PathName.Replace('"','')
$ssrsExeFileVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($ssrsExePath)
$ssrsMajorVersion = $ssrsExeFileVersion.ProductMajorPart
$ssrsVersionDisplayName = switch ($ssrsMajorVersion)
{
    11 {"2012"}
    12 {"2014"}
    13 {"2016"}
    14 {"2017"}
    15 {"2019"}
    default {""}
}
if ($ssrsVersionDisplayName -eq "") {
    Write-Host "Unknown SSRS Version detected. " -NoNewline
    Write-Host "Aborting ..." -ForegroundColor Yellow
    EndScriptExecution
}

[System.IO.DirectoryInfo]$ssrsReportServerFolder = (Get-Item -Path $ssrsExePath).Directory.Parent
if ($ssrsMajorVersion -ge 14) {
    $ssrsReportServerFolder =    Join-Path $ssrsReportServerFolder.FullName "ReportServer"
}
[string]$ssrsReportServerFolder = $ssrsReportServerFolder.FullName 
[string]$ssrsReportServerBinFolder = Join-Path $ssrsReportServerFolder "bin"
#endregion

#region Checking DLL
$scsmDllFileExists = $false
$scsmDllFileName = "Microsoft.EnterpriseManagement.Reporting.Code.dll"
$scsmDllFilePath = Join-Path $ssrsReportServerBinFolder $scsmDllFileName
$scsmDllFileExists = (Test-Path -Path $scsmDllFilePath)
if (-not $scsmDllFileExists) {
    Write-Host "ERROR: "  -ForegroundColor Yellow -NoNewline
    Write-Host "The file '$scsmDllFileName' does *NOT* exist in '$ssrsReportServerBinFolder'"
}
else {
    Write-Host " Pass: The file '$scsmDllFileName' does exist in '$ssrsReportServerBinFolder'" 
}
Write-Host ""
#endregion

#region Checking rssrvpolicy.config
$rssrvpolicy_configIsCorrect = $false
$rssrvpolicy_configFileName = "rssrvpolicy.config"
$rssrvpolicy_configFilePath = Join-Path $ssrsReportServerFolder $rssrvpolicy_configFileName
$rssrvpolicy_configFileExists = (Test-Path -Path $rssrvpolicy_configFilePath)
if (-not $rssrvpolicy_configFileExists) {
    Write-Host "$rssrvpolicy_configFileName does *NOT* exist in $ssrsReportServerFolder" -ForegroundColor Yellow
}
if ($rssrvpolicy_configFileExists) {    
    
    [xml]$xml = Get-Content $rssrvpolicy_configFilePath
    
    $tagNameToFind = "CodeGroup"
    $attributeNameToFind = "Name"
    $attributeValueToFind = "Microsoft System Center Service Manager Reporting Code Assembly"
    $nodeToFind = Select-Xml -XPath "//$tagNameToFind[@$attributeNameToFind='$attributeValueToFind']" -Xml $xml

    if ($nodeToFind -eq $null) {
        Write-Host "ERROR: "  -ForegroundColor Yellow -NoNewline
        Write-Host "The file '$rssrvpolicy_configFileName' in '$ssrsReportServerFolder' does *NOT* contain the correct <$tagNameToFind> node." 
    }
    else {

        $CodeGroup_NodeToVerify = [System.Xml.XmlNode]$nodeToFind.Node
        $IMembershipCondition_NodeToVerify = [System.Xml.XmlNode]$CodeGroup_NodeToVerify.IMembershipCondition

        $rssrvpolicy_configIsCorrect =  ( $CodeGroup_NodeToVerify.class -eq "UnionCodeGroup" `
            -and $CodeGroup_NodeToVerify.version -eq "1" `
            -and $CodeGroup_NodeToVerify.PermissionSetName -eq "FullTrust" `
            -and $IMembershipCondition_NodeToVerify.class -eq "StrongNameMembershipCondition" `
            -and $IMembershipCondition_NodeToVerify.version -eq "1" `
            -and $IMembershipCondition_NodeToVerify.PublicKeyBlob -eq "0024000004800000940000000602000000240000525341310004000001000100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF46B2A2B1247ADC3652BF5C308055DA9"
        ) 

        if (-not $rssrvpolicy_configIsCorrect) {
            Write-Host "ERROR: "  -ForegroundColor Yellow -NoNewline
            Write-Host "The <$tagNameToFind> node in '$rssrvpolicy_configFileName' in '$ssrsReportServerFolder' does exists but its content is *NOT* correct."
        }
        else {
            Write-Host " Pass: The content of '$rssrvpolicy_configFileName'    in '$ssrsReportServerFolder' is correct."             
        }
    }

}
Write-Host ""
#endregion

#region Checking rsreportserver.config
$rsreportserver_configIsCorrect = $false
$rsreportserver_configFileName = "rsreportserver.config"
$rsreportserver_configFilePath = Join-Path $ssrsReportServerFolder $rsreportserver_configFileName
$rsreportserver_configFileExists = (Test-Path -Path $rsreportserver_configFilePath)
if (-not $rsreportserver_configFileExists) {
    Write-Host "$rsreportserver_configFileName does *NOT* exist in $ssrsReportServerFolder" -ForegroundColor Yellow
}
if ($rsreportserver_configFileExists) {
     
    [xml]$xml = Get-Content $rsreportserver_configFilePath
    
    $tagNameToFind = "Extension"
    $attributeNameToFind = "Name"
    $attributeValueToFind = "SCDWMultiMartDataProcessor"
    $nodeToFind = Select-Xml -XPath "//$tagNameToFind[@$attributeNameToFind='$attributeValueToFind']" -Xml $xml

    if ($nodeToFind -eq $null) {
        Write-Host "ERROR: "  -ForegroundColor Yellow -NoNewline
        Write-Host "The file '$rsreportserver_configFileName' in '$ssrsReportServerFolder' does *NOT* contain the correct <$tagNameToFind> node."
    }
    else {

        $Extension_NodeToVerify = [System.Xml.XmlNode]$nodeToFind.Node
        $rsreportserver_configIsCorrect =  ( $Extension_NodeToVerify.Type.Replace(" ","") -eq "Microsoft.EnterpriseManagement.Reporting.MultiMartConnection, Microsoft.EnterpriseManagement.Reporting.Code".Replace(" ","") ) 

        if (-not $rsreportserver_configIsCorrect) {
            Write-Host "ERROR: "  -ForegroundColor Yellow -NoNewline
            Write-Host "The <$tagNameToFind> node in '$rsreportserver_configFileName' in '$ssrsReportServerFolder' does exists but its content is *NOT* correct." 
        }
        else {
            Write-Host " Pass: The content of '$rsreportserver_configFileName' in '$ssrsReportServerFolder' is correct."             
        }
    }

}
Write-Host ""
#endregion

#region Conclusion
""
Write-Host "Conclusion:" -ForegroundColor Cyan
Write-Host "==========="
if ($scsmDllFileExists -and $rsreportserver_configIsCorrect -and $rssrvpolicy_configIsCorrect) {
    Write-Host "The selected SSRS instance is configured correctly."
}
else {
    Write-Host "The selected SSRS instance is " -NoNewline
    Write-Host "*NOT* configured correctly." -ForegroundColor Yellow
    Write-Host "Please follow the steps at  " -NoNewline
    Write-Host "https://learn.microsoft.com/system-center/scsm/config-remote-ssrs" -ForegroundColor Yellow
}
EndScriptExecution
#endregion

Дальнейшие действия