1 # Signing script for Azure Code Signing
2 # Arguments: sign_azure.ps1 path_to_sign
4 # Environment variables must be set up before use:
9 # AZURE_CODESIGN_ACCOUNT_NAME
10 # AZURE_CODESIGN_ENDPOINT
11 # AZURE_CODESIGN_PROFILE_NAME
16 [Parameter
(Mandatory
=$true, Position
=0)]
20 if (!$Env:AZURE_CODESIGN_ENDPOINT
-or
!$Env:AZURE_CODESIGN_ACCOUNT_NAME
-or
!$Env:AZURE_CODESIGN_PROFILE_NAME
-or
21 !$Env:AZURE_TENANT_ID
-or
!$Env:AZURE_CLIENT_ID
-or
!$Env:AZURE_CLIENT_SECRET
)
23 "Code signing variables not found; most likely running in a fork. Skipping signing."
27 Install-Module
-Name AzureCodeSigning
-Scope CurrentUser
-RequiredVersion
0.3.0 -Force
-Repository PSGallery
31 $params["Endpoint"] = $Env:AZURE_CODESIGN_ENDPOINT
32 $params["CodeSigningAccountName"] = $Env:AZURE_CODESIGN_ACCOUNT_NAME
33 $params["CertificateProfileName"] = $Env:AZURE_CODESIGN_PROFILE_NAME
34 $params["FilesFolder"] = $FilesFolder
35 $params["FilesFolderFilter"] = "exe"
36 $params["FileDigest"] = "SHA256"
37 $params["TimestampRfc3161"] = "http://timestamp.acs.microsoft.com"
38 $params["TimestampDigest"] = "SHA256"
40 Invoke-AzureCodeSigning @params