Skip to content

Commit

Permalink
Merge pull request #2806 from freddydk/master
Browse files Browse the repository at this point in the history
x
  • Loading branch information
freddydk committed Nov 29, 2022
2 parents 901cde2 + 06b3169 commit b48760a
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion AppHandling/Sign-NavContainerApp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,53 @@ try {
TestPfxCertificate -pfxFile $sharedPfxFile -pfxPassword $pfxPassword -certkind "Codesign"

Invoke-ScriptInBcContainer -containerName $containerName -ScriptBlock { Param($appFile, $pfxFile, $pfxPassword, $timeStampServer, $digestAlgorithm, $importCertificate)


function GetExtendedErrorMessage {
Param(
$errorRecord
)

$exception = $errorRecord.Exception
$message = $exception.Message

try {
$errorDetails = $errorRecord.ErrorDetails | ConvertFrom-Json
$message += " $($errorDetails.error)`r`n$($errorDetails.error_description)"
}
catch {}
try {
if ($exception -is [System.Management.Automation.MethodInvocationException]) {
$exception = $exception.InnerException
}
$webException = [System.Net.WebException]$exception
$webResponse = $webException.Response
try {
if ($webResponse.StatusDescription) {
$message += "`r`n$($webResponse.StatusDescription)"
}
} catch {}
$reqstream = $webResponse.GetResponseStream()
$sr = new-object System.IO.StreamReader $reqstream
$result = $sr.ReadToEnd()
try {
$json = $result | ConvertFrom-Json
$message += "`r`n$($json.Message)"
}
catch {
$message += "`r`n$result"
}
try {
$correlationX = $webResponse.GetResponseHeader('ms-correlation-x')
if ($correlationX) {
$message += " (ms-correlation-x = $correlationX)"
}
}
catch {}
}
catch{}
$message
}

if ($importCertificate) {
Import-PfxCertificate -FilePath $pfxFile -Password $pfxPassword -CertStoreLocation "cert:\localMachine\root" | Out-Null
Import-PfxCertificate -FilePath $pfxFile -Password $pfxPassword -CertStoreLocation "cert:\localMachine\my" | Out-Null
Expand Down

0 comments on commit b48760a

Please sign in to comment.