Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to deploy to Service Fabric if the Service Connection uses Common Name for the Server Certificate Lookup #14486

Closed
RobdeT opened this issue Mar 1, 2021 · 1 comment
Assignees

Comments

@RobdeT
Copy link

RobdeT commented Mar 1, 2021

Required Information

Question, Bug, or Feature?
Type: Bug

Enter Task Name: ServiceFabricDeploy, ServiceFabricComposeDeploy

list here (V# not needed):
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks/ServiceFabricDeployV1
https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/ServiceFabricComposeDeployV0

Environment

  • Server - Azure Pipelines or TFS on-premises?
    Azure Pipelines

  • Agent - Hosted or Private:
    Hosted

Issue Description

Unable to deploy to Service Fabric if the Service Connection uses Common Name for the Server Certificate Lookup due to a PowerShell error in
https://github.com/Microsoft/azure-pipelines-tasks/Tasks/Common/ServiceFabricHelpers/Get-ServiceFabricEncryptedText.ps1.

There is a typo in this module at line 82.

the line is:

$serverCertThumbprints = null;

This correctly throws an error of "null: The term 'null' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.".

The error is in a function Get-ServerCertThumbprints (line 70) which is called twice from the function Get-ServiceFabricEncryptedText (line 3). The first time (line 34) is in a try-catch block but the second is within the catch block itself (line 39).

Since this second invocation at line 39 does not catch the error, the task aborts.

The line should be:

$serverCertThumbprints = $null;

Error logs

2021-02-25T13:03:58.3821772Z ##[debug]Caught exception from task script.
2021-02-25T13:03:58.3849431Z ##[debug]Error record:
2021-02-25T13:03:58.4456437Z ##[debug]null : The term 'null' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2021-02-25T13:03:58.4467187Z ##[debug]At D:\a\_tasks\ServiceFabricDeploy_19c02b15-d377-40e0-9efa-3168506e0933\1.9.3\ps_modules\ServiceFabricHelpers\Get-ServiceFabricEncryptedText.ps1:82 char:30
2021-02-25T13:03:58.4477854Z ##[debug]+     $serverCertThumbprints = null;
2021-02-25T13:03:58.4488319Z ##[debug]+                              ~~~~
2021-02-25T13:03:58.4499305Z ##[debug]    + CategoryInfo          : ObjectNotFound: (null:String) [], CommandNotFoundException
2021-02-25T13:03:58.4509713Z ##[debug]    + FullyQualifiedErrorId : CommandNotFoundException
2021-02-25T13:03:58.4520163Z ##[debug] 
2021-02-25T13:03:58.4535625Z ##[debug]Script stack trace:
2021-02-25T13:03:58.4568628Z ##[debug]at Get-ServerCertThumbprints, D:\a\_tasks\ServiceFabricDeploy_19c02b15-d377-40e0-9efa-3168506e0933\1.9.3\ps_modules\ServiceFabricHelpers\Get-ServiceFabricEncryptedText.ps1: line 82
2021-02-25T13:03:58.4579079Z ##[debug]at Get-ServiceFabricEncryptedText, D:\a\_tasks\ServiceFabricDeploy_19c02b15-d377-40e0-9efa-3168506e0933\1.9.3\ps_modules\ServiceFabricHelpers\Get-ServiceFabricEncryptedText.ps1: line 39
vineetmimrot added a commit that referenced this issue Mar 2, 2021
* Fix Powershell null assignment error

#14486

* Update task.json

* Update task.loc.json

* Update task.json

* Update task.loc.json

* Update task.json

* Update task.loc.json
@vineetmimrot
Copy link
Member

This has been fixed and will be available to you in maximum next 3 weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants