File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,31 @@ steps:
84
84
files_to_sign : ' **\*.psd1;**\*.psm1;**\*.ps1xml;**\*.ps1;**\*.dll;**\*.exe;**\pwsh'
85
85
search_root : $(Pipeline.Workspace)/toBeSigned
86
86
87
+ - task : onebranch.pipeline.signing@1
88
+ displayName : Sign pwsh.exe with Windows cert
89
+ inputs :
90
+ command : ' sign'
91
+ cp_code : ' 203'
92
+ files_to_sign : ' **\pwsh.exe'
93
+ search_root : $(Pipeline.Workspace)/toBeSigned
94
+
95
+ - pwsh : |
96
+ if (Test-Path $(Pipeline.Workspace)/toBeSigned/pwsh.exe) {
97
+ Write-Verbose -Verbose "pwsh.exe is found, verifying signature"
98
+ $signature = Get-AuthenticodeSignature -FilePath $(Pipeline.Workspace)/toBeSigned/pwsh.exe
99
+ if ($signature.SignerCertificate.Issuer -notmatch '^CN=Microsoft Windows Production.*') {
100
+ Write-Error -ErrorAction Stop "pwsh.exe is not signed by Microsoft"
101
+ }
102
+ else {
103
+ Write-Verbose -Verbose "pwsh.exe is signed by Microsoft"
104
+ }
105
+ }
106
+ else {
107
+ Write-Verbose -Verbose "pwsh.exe is not found, skipping"
108
+ }
109
+
110
+ displayName : ' Verify windows signature'
111
+
87
112
- pwsh : |
88
113
Get-ChildItem -Path env:
89
114
displayName : Capture environment
You can’t perform that action at this time.
0 commit comments