Comments (2)
Hi Guys,
I've created my own solution to the problem, that you could also use.
I've fixed function that was created by @RuiRomano for SQL 2008 to make it work with 2016 and 2017
Also note the wmi call would need to be versioned as I was working with PowerBi Server and SQL 2017 so its version v14 however I did test with SQl 2016 using v13 and that works fine as well.
As I was testing locally I needed to create selfsign so that part can be dropped, however I've kept it in so you can see the end to end how it works.
Get FQDN
$dnsname = ([System.Net.Dns]::GetHostByName((hostname)).HostName)
#Create SSL Certificate (replace with PKI function)
New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My -DnsName $dnsname -FriendlyName PBIRS
Get the cert Thumbprint
$certHash = (Get-ChildItem -Path cert:\LocalMachine\My -DnsName $dnsname).Thumbprint
Make cert trusted
$cert = (Get-ChildItem -Path Cert:\LocalMachine\My\$certHash)
Export-Certificate -Cert $cert -FilePath c:\cert.cer
$file = ( Get-ChildItem -Path C:\cert.cer )
$file | Import-Certificate -CertStoreLocation Cert:\LocalMachine\Root
Function
function Set-SSRSSystemConfiguration($sslUrl, $certHash, $sslPort, $ReportServerInstance){
# https://ruiromanoblog.wordpress.com/2010/05/08/configure-reporting-services-ssl-binding-with-wmi-powershell/
# The .ToLower() avoids the error “A Secure Sockets Layer (SSL) certificate is not configured on the Web site.”
$certHash = $certHash.ToLower()
Write-Output “Configure SSRS SSL binding”
$serverClass = get-wmiobject -namespace "root\Microsoft\SqlServer\ReportServer\RS_$ReportServerInstance\v14\Admin" -class “MSReportServer_ConfigurationSetting”
if ($serverClass -eq $null) { throw “Cannot find wmi class” }
$lcid = [System.Globalization.CultureInfo]::GetCultureInfo(“pt-PT”).LCID
$result = $serverClass.RemoveURL(“ReportServerWebService”, $sslUrl, $lcid)
if (!($result.HRESULT -eq 0)) { write-error $result.Error }
$result = $serverClass.ReserveURL(“ReportServerWebService”, $sslUrl, $lcid)
if (!($result.HRESULT -eq 0)) { write-error $result.Error }
$result = $serverClass.RemoveSSLCertificateBindings(“ReportServerWebService”, $certHash, “0.0.0.0”, $sslPort, $lcid)
if (!($result.HRESULT -eq 0)) { write-error $result.Error }
$result = $serverClass.CreateSSLCertificateBinding(“ReportServerWebService”, $certHash, “0.0.0.0”, $sslPort, $lcid)
if (!($result.HRESULT -eq 0)) { write-error $result.Error }
$result = $serverClass.RemoveURL(“ReportServerWebApp”, $sslUrl, $lcid)
if (!($result.HRESULT -eq 0)) { write-error $result.Error }
$result = $serverClass.ReserveURL(“ReportServerWebApp”, $sslUrl, $lcid)
if (!($result.HRESULT -eq 0)) { write-error $result.Error }
$result = $serverClass.RemoveSSLCertificateBindings(“ReportServerWebApp”, $certHash, “0.0.0.0”, $sslPort, $lcid)
if (!($result.HRESULT -eq 0)) { write-error $result.Error }
$result = $serverClass.CreateSSLCertificateBinding(“ReportServerWebApp”, $certHash, “0.0.0.0”, $sslPort, $lcid)
if (!($result.HRESULT -eq 0)) { write-error $result.Error }
} #close funciton
Call function to configure the SSL binding
Set-SSRSSystemConfiguration "https://$($dnsname):443" $certHash 443 PBIRS
from reportingservicestools.
Hey Guys,
Thanks @HealisticEngineer for the TLS function!
For SSRS 2019 I had to add the SetSecureConnectionLevel
method, appart from that, works like a charm.
function Set-SSRSSystemConfiguration($sslUrl, $certHash, $sslPort, $ReportServerInstance){
# https://ruiromanoblog.wordpress.com/2010/05/08/configure-reporting-services-ssl-binding-with-wmi-powershell/
# The .ToLower() avoids the error “A Secure Sockets Layer (SSL) certificate is not configured on the Web site.”
$certHash = $certHash.ToLower()
Write-Output “Configure SSRS SSL binding”
...
$result = $serverClass.SetSecureConnectionLevel("1")
if (!($result.HRESULT -eq 0)) { write-error $result.Error }
} #close funciton
+1 for adding SSL Support
from reportingservicestools.
Related Issues (20)
- SSRS 2022 Support in "library.ps1" HOT 2
- Download all SSRS reports via PS script error
- Set-RsRestItemDataSource fails to update linked data sources in reports HOT 1
- Adding Get-RsRestDataSource function HOT 1
- Failed to create catalog item: The remote server returned an error: (422) HOT 1
- Apparent bug with Copy-RsSubscription where a parameter is null HOT 1
- Update of Readme?
- SQL Server 2022 version 16 HOT 7
- Cannot pass parameters to Invoke-WebRequest from New-RsRestSession HOT 2
- Is there a way to delete one or more history snapshots?
- Changing an embedded report datasource to a shared datasource
- GetWMICOMException with PowerShell to remote host
- Failed to create a new session The remote server returned an error: (404) Not Found.
- Write-RsCatalogItem not exporting State Indicators for Gauge Panels
- Write-RsRestCatalogItem doesn't work with large Power BI reports (>25 MB or > MinLargeFileSizeInMb)
- Set-RsDatabase on offline machine: SqlServer PowerShell module version is wrong
- If Report has more than 1 subscription Copy-RsSubscription targets the Source report after the 1st Subscription is copied
- Powershell Module GUID is not unique
- Write-RsRestFolderContent not working in PowerBi Report Server
- "Get-RsFolderContent" not working !!! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reportingservicestools.