Is it possible to install a certificate while running PowerShell Universal as a service, or do you need to configure PSU to run using IIS in order to have the ability to use the SSL certificate when browsing to the dashboard URL?
Yes it is possible. You need to edit your appsettings.json with the correct values. Here is the documentation for it.
Here is a sanitized version of mine. Note that the path to the certificate needs double slashes. You can also use the certificate store like the documentation shows.
@turnitoff_onagain so I have the JSON configured. When I browse to the URL in a web browser, I get the default Windows Server IIS page. Is there some configuration I’m missing in IIS to redirect the user to the PowerShell Universal dashboard page?
I don’t really need IIS at all. I only installed it because I wasn’t sure if it was required in order to use the cert (I was running into issues trying to use while running PSU as a service).
I’ve uninstalled IIS and am now troubleshooting the appsettings.json. I’ve modified the JSON but I think I might be missing something. I’m trying to follow the format at Hosting - PowerShell Universal using the local certificate store:
If I use the default appsettings.json file, everything works fine. I’m only running into issues when I try to modify the appsettings.json to include and use the certificate. The page doesn’t load properly.
So in my certificate, I’m using three DNS names, and therefore there were three items listed in the subject field of the certificate. I ended up figuring out that if I use only the last object in the subject (removed the “CN =”), that the website works with the installed certificate. I’m not sure why I had to use the last item in the subject but that’s working for me.
I now can access the dashboard by navigating to https://AnyOfTheThreeDNSnames:10003
While running PSU as a service, how can accomplish the following:
Automatically forward the user to port 10003 so that they don’t have to type that in the URL
Automatically forward the user’s request to https so they only have to type in the DNS name in the URL
For some reason I thought we had certain traffic restricted in the space that the dashboard server sits in. Nevertheless, 443 is working like a champ! I’m now able to access the dashboard using https and using the CNAME in the URL.
Helpful notes:
CNames were created to point to the hostname of the server hosting PSU.
My certificate had multiple subjects so that users can use multiple cnames to access the dashboard. When I attempted to use all three as the subject in the appsettings.json, I was unable to access the admin page and any dashboards. Event viewer was throwinga .NET Runtime error (ID 1026) stating that the requested certificate could not be found.
After changing the subject in the appsettings.json to one of the subjects (See code below) and restarted the PSU service, https started working.
@adam , the configuration above is working, but when I use the DNS CNAME by it self in a web browser, it is pointing me (and users) to the login page. Is there a way I can point that CNAME to a specific dashboard url? I can use the CNAME and add the path to the desired dashboard, but I’m wanting to tie this specific CNAME to a specific dashboard to shorten the url.
Is this possible when running PSU as a service without needing to install IIS to add a redirect?
@adam ok, cool. That definitely gets me where I’m trying to accomplish.
As far as multiple dashboard go, I see you can just append the name of the desired dashboard such as “CNAME/dash1” or “CNAME/dash2”. I could make that work, but as far as “binding” CNAME1 to dash1 and CNAME2 to dash2 etc., I’m assuming there’s no way to do that outside of IIS?
I normally don’t like to resurrect old threads, but this one is pretty close to the issue I am seeing. We recently had to renew the cert for the server, so I went through that process and installed the new cert on the machine (we use a third-party to manage and sign our certs). New cert was setup the same as the old cert. However, when I got to the web interface for the platform, it tells me that the site doesn’t have a cert. Some environment details:
PSU is set up to run as a service, no IIS.
Subject for cert is the same as the previous one.
Cert reports ok all the way up the chain.
I will say that I came into this environment with it already set up. We are running 2.9.2 but plan to upgrade shortly. My appsettings looks like this:
This differs slightly from the documentation, but is a valid option for Kestrel, so I’m not sure if it is a problem, or just another way to do it. I have limited experience here. Thoughts?