From 09d811b7efd08f09c96e82a9d042b29f6984c65b Mon Sep 17 00:00:00 2001 From: Shivangi Date: Fri, 15 Nov 2019 13:50:22 +0530 Subject: [PATCH] Changes in Common --- Tasks/Common/VstsAzureHelpers_/Utility.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tasks/Common/VstsAzureHelpers_/Utility.ps1 b/Tasks/Common/VstsAzureHelpers_/Utility.ps1 index 4d6b94d0b057..9d5f2b59f2d4 100644 --- a/Tasks/Common/VstsAzureHelpers_/Utility.ps1 +++ b/Tasks/Common/VstsAzureHelpers_/Utility.ps1 @@ -5,14 +5,14 @@ [Switch] $ServicePrincipal ) - # Add the certificate to the cert store. - $certificate = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 + $certificate = "" if ($ServicePrincipal) { $pemFileContent = $Endpoint.Auth.Parameters.ServicePrincipalCertificate $pfxFilePath, $pfxFilePassword = ConvertTo-Pfx -pemFileContent $pemFileContent - $certificate.Import($pfxFilePath, $pfxFilePassword, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::PersistKeySet) + # Add the certificate to the cert store. + $certificate = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($pfxFilePath, $pfxFilePassword, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::PersistKeySet) } else { $bytes = [System.Convert]::FromBase64String($Endpoint.Auth.Parameters.Certificate)