Add module for Power BI Reporting Services
This adds Set-PBIRSCertificate. Usage is the same as most of the other modules. Tested with Power BI Report Server 15.0.1105.195.
Thanks for the PR, @Twenix83. It might be a bit before I can look at this because there's some other issues and PRs I've been slacking on that are higher priority. But we'll get there.
Okay, thank you! Meanwhile I can script modules for MSSQL and such, so that you don't get bored :-)
So fair warning, I know absolutely zero about PowerBI. Do you know of any guides out there for doing a quick barebones setup, so I can test things out? The code makes it look like we're just tweaking certs for MSSQL under the hood. Is there value in having a PowerBI specific function over a more generic MSSQL one?
Alternatively, would having a generic MSSQL function allow simplifying the PowerBI function by wrapping the MSSQL one with some extra defaults and logic?
After a quick skim of the code, the main thing I'd like to tweak is the use of the Get-WMIObject function. I've been trying to keep everything using the equivalent CIM function, Get-CIMInstance which is newer and more future-proof.
It looks like the Get-WMIObject calls can be replaced outright with Get-CimInstance using the same parameters. So this
# Get the name of the PBIRS server
$PBIRSServerName = (Get-WmiObject -Namespace root\Microsoft\SqlServer\ReportServer -Class __Namespace).Name
# Get the version of the PBIRS server
$PBIRSVersion = (Get-WmiObject -Namespace root\Microsoft\SqlServer\ReportServer\$PBIRSServerName -Class __Namespace).Name
# Get the configuration of the PBIRS server
$PBIRSConfig = Get-WmiObject -Namespace "root\Microsoft\SqlServer\ReportServer\$PBIRSServerName\$PBIRSVersion\Admin" -Class MSReportServer_ConfigurationSetting
Can be replaced by this:
$rsRoot = $rsRoot = "root\Microsoft\SqlServer\ReportServer"
# Get the name of the PBIRS server
$PBIRSServerName = (Get-CimInstance -Namespace $rsRoot -Class __Namespace).Name
# Get the version of the PBIRS server
$PBIRSVersion = (Get-CimInstance -Namespace $rsRoot\$PBIRSServerName -Class __Namespace).Name
# Get the configuration of the PBIRS server
$PBIRSConfig = Get-CimInstance -Namespace "$rsRoot\$PBIRSServerName\$PBIRSVersion\Admin" -Class MSReportServer_ConfigurationSetting
It also probably makes more sense to replace the hard coded DE locale with whatever is current:
$lcid = [System.Globalization.CultureInfo]::CurrentCulture.LCID
The WMI method calls work a bit differently though since you can't just call them directly from the CimInstance returned objects. It looks like you need to call them using Invoke-CimMethod like this for example:
$WebApplications = (Invoke-CimMethod -InputObject $PBIRSConfig -MethodName ListSSLCertificateBindings -Arguments @{lcid=$lcid}).Application
Sorry for the late response. I am very busy atm.
So fair warning, I know absolutely zero about PowerBI. Do you know of any guides out there for doing a quick barebones setup, so I can test things out? The code makes it look like we're just tweaking certs for MSSQL under the hood. Is there value in having a PowerBI specific function over a more generic MSSQL one?
Alternatively, would having a generic MSSQL function allow simplifying the PowerBI function by wrapping the MSSQL one with some extra defaults and logic?
PowerBI Reporting Services is a web server software that is included in the same installer disc, but it is a diferent product. Under the hood it seems to be IIS (because of using web.config and so on). I think that configuring it via an extra parameter in a generic MSSQL module makes it more complicated.
It looks like the
Get-WMIObjectcalls can be replaced outright withGet-CimInstanceusing the same parameters. So this# Get the name of the PBIRS server $PBIRSServerName = (Get-WmiObject -Namespace root\Microsoft\SqlServer\ReportServer -Class __Namespace).Name # Get the version of the PBIRS server $PBIRSVersion = (Get-WmiObject -Namespace root\Microsoft\SqlServer\ReportServer\$PBIRSServerName -Class __Namespace).Name # Get the configuration of the PBIRS server $PBIRSConfig = Get-WmiObject -Namespace "root\Microsoft\SqlServer\ReportServer\$PBIRSServerName\$PBIRSVersion\Admin" -Class MSReportServer_ConfigurationSettingCan be replaced by this:
$rsRoot = $rsRoot = "root\Microsoft\SqlServer\ReportServer" # Get the name of the PBIRS server $PBIRSServerName = (Get-CimInstance -Namespace $rsRoot -Class __Namespace).Name # Get the version of the PBIRS server $PBIRSVersion = (Get-CimInstance -Namespace $rsRoot\$PBIRSServerName -Class __Namespace).Name # Get the configuration of the PBIRS server $PBIRSConfig = Get-CimInstance -Namespace "$rsRoot\$PBIRSServerName\$PBIRSVersion\Admin" -Class MSReportServer_ConfigurationSetting
To be fair: I am no expert at WMI and CIM. I searched different guides and with my general knowledge I assembled it to a working code. At the first view your code looks good in my eyes. I could test it if I find the time.
It also probably makes more sense to replace the hard coded DE locale with whatever is current:
$lcid = [System.Globalization.CultureInfo]::CurrentCulture.LCID
You are absolutely right. I don't know why I don't have it in the pull request because I also used it during testing.
Another discussion but my problem is that I really like your your module, but at the moment we are configuring our whole environment via ansible which often uses DSC for things. And a nice DSC module for configuring certificates should be much better for us than the command approach. But both approaches have their use cases.