Tool: Visual Studio, Visual Studio Code, PSScriptPad, PowerShell Module
Version:
Highlights for version 2021.11.1 say there is support for signing executables, I wonder if you can explain how that is done. Is there an example page?
Tool: Visual Studio, Visual Studio Code, PSScriptPad, PowerShell Module
Version:
Highlights for version 2021.11.1 say there is support for signing executables, I wonder if you can explain how that is done. Is there an example page?
Bump
I would also like to know how to do this. I was not able to find it in either application.
@adam Can you please advise where in the products are we able to use this feature?
This is available in the package.psd1 but not currently Visual Studio. You can set the certificate here: Package.psd1 - PowerShell Pro Tools
@adam I can confirm that this feature is accessible and working as expected in VS Code per the documentation you linked. Thanks for help!
@banyula Happy day (yesterday)
Hi @banyula, I put together a step-by-step in case it helps anyone. Suggestions for improvement are welcome.
Step 1
Create the cert and move it to the AuthRoot
[string]$password = "1234"
[securestring]$secure_pwd = ConvertTo-SecureString -String $password -Force -AsPlainText
[System.Security.Cryptography.X509Certificates.X509Certificate]$cert = New-SelfSignedCertificate -DNSName "acme.com" -CertStoreLocation Cert:\CurrentUser\My -Type CodeSigningCert -Subject "Test Script 20220124a"
[string]$cert_thumbprint = $cert.Thumbprint
Move-Item (Join-Path Cert:\CurrentUser\My $cert_thumbprint) -Destination Cert:\CurrentUser\AuthRoot
[string]$cert_path = ('Cert:\CurrentUser\AuthRoot\' + $cert_thumbprint)
Write-Output $cert_path
Step 2
Create the default package manifest file (package.psd1) by building the solution to exe (pictured below).
This should produce below notification that the manifest (package.psd1 file) was created (pictured below). You will also have an exe but it is unsigned and will be overwritten later.
Step 3
Edit the package.psd1 file. Add the Certificate property with the path from the last line of the certificate creation script from Step 1 (pictured below)
Step 4
Build the solution a 2nd time
Step 5
Check the properties of the resulting exe file to ensure that the certificate was applied.