I am creating a Azure DevOps task for the first time so please bear with me. I created a task which needs to connect to service fabric cluster which is hosted on azure. I borrowed a piece of code from serviceFabricDeployv1 task on github to connect to the cluster. When I published this task & used it, I got the following error: Cannot index into a null array. I then enabled debug mode and the error points to Connect-ServiceFabricClusterFromServiceEndpoint:
2019-04-05T17:43:58.7031978Z ##[debug]Entering D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\powershell.ps1.
2019-04-05T17:43:58.7326382Z ##[debug]Loading module from path 'D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\ServiceFabricHelpers.psm1'.
2019-04-05T17:43:58.7457125Z ##[debug]Loading resource strings from: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\module.json
2019-04-05T17:43:58.7798307Z ##[debug]Loaded 17 strings.
2019-04-05T17:43:58.7852857Z ##[debug]SYSTEM_CULTURE: 'en-US'
2019-04-05T17:43:58.7877741Z ##[debug]Loading resource strings from: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\Strings\resources.resjson\en-US\resources.resjson
2019-04-05T17:43:58.8294503Z ##[debug]Loaded 17 strings.
2019-04-05T17:43:58.8552233Z ##[debug]Entering Find-VstsFiles.
2019-04-05T17:43:58.8652603Z ##[debug] LiteralDirectory: 'D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers'
2019-04-05T17:43:58.8675211Z ##[debug] LegacyPattern: '*.ps1'
2019-04-05T17:43:59.5468797Z ##[debug]Entering Get-MatchingItems.
2019-04-05T17:43:59.5509999Z ##[debug] IncludePatterns: 'D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\*.ps1'
2019-04-05T17:43:59.5573606Z ##[debug] ExcludePatterns: ''
2019-04-05T17:43:59.5624335Z ##[debug] IncludeFiles: 'True'
2019-04-05T17:43:59.5666234Z ##[debug] IncludeDirectories: 'False'
2019-04-05T17:43:59.5684855Z ##[debug] Force: 'False'
2019-04-05T17:44:00.0606696Z ##[debug]Paths: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\
2019-04-05T17:44:00.0629904Z ##[debug] CommonHelpers.ps1
2019-04-05T17:44:00.0630803Z ##[debug] Connect-ServiceFabricClusterFromServiceEndpoint.ps1
2019-04-05T17:44:00.0631002Z ##[debug] Get-ServiceFabricEncryptedText.ps1
2019-04-05T17:44:00.0631429Z ##[debug] SFOperations.ps1
2019-04-05T17:44:00.0632558Z ##[debug]Leaving Get-MatchingItems.
2019-04-05T17:44:00.0796566Z ##[debug]Total found: 4
2019-04-05T17:44:00.0818584Z ##[debug]Leaving Find-VstsFiles.
2019-04-05T17:44:00.0836639Z ##[debug]Exporting function 'Connect-ServiceFabricClusterFromServiceEndpoint'.
2019-04-05T17:44:00.0854254Z ##[debug]Exporting function 'Remove-ClientCertificate'.
2019-04-05T17:44:00.0873015Z ##[debug]Exporting function 'Get-ServiceFabricEncryptedText'.
2019-04-05T17:44:00.0895219Z ##[debug]Exporting variable 'SF_Operations'.
2019-04-05T17:44:00.0913326Z ##[debug]Exporting function 'Publish-Telemetry'.
2019-04-05T17:44:00.0931512Z ##[debug]Exporting function 'Get-SfSdkVersion'.
2019-04-05T17:44:00.0948589Z ##[debug]Exporting function 'Trace-WarningIfCertificateNotPresentInLocalCertStore'.
2019-04-05T17:44:00.2293992Z ##[debug]Importing function 'Connect-ServiceFabricClusterFromServiceEndpoint'.
2019-04-05T17:44:00.2348563Z ##[debug]Importing function 'Get-ServiceFabricEncryptedText'.
2019-04-05T17:44:00.2364893Z ##[debug]Importing function 'Get-SfSdkVersion'.
2019-04-05T17:44:00.2365479Z ##[debug]Importing function 'Publish-Telemetry'.
2019-04-05T17:44:00.2365962Z ##[debug]Importing function 'Remove-ClientCertificate'.
2019-04-05T17:44:00.2366440Z ##[debug]Importing function 'Trace-WarningIfCertificateNotPresentInLocalCertStore'.
2019-04-05T17:44:00.2381806Z ##[debug]Importing variable 'SF_Operations'.
2019-04-05T17:44:00.2595362Z ##[debug]INPUT_NAME: 'Test'
2019-04-05T17:44:00.2618846Z ##[debug]INPUT_SERVICECONNECTIONNAME: '9d750132-3d2f-4be1-9896-ZZZZZZZZZZZZ'
2019-04-05T17:44:00.2743138Z ##[debug]ENDPOINT_URL_9d750132-3d2f-4be1-9896-ZZZZZZZZZZZZ: 'tcp://XXXXXXX-dev.eastus.cloudapp.azure.com:19000/'
2019-04-05T17:44:00.2768982Z ##[debug]ENDPOINT_AUTH_9d750132-3d2f-4be1-9896-ZZZZZZZZZZZZ: '********'
2019-04-05T17:44:00.2795548Z ##[debug]ENDPOINT_DATA_9d750132-3d2f-4be1-9896-ZZZZZZZZZZZZ: '{}'
2019-04-05T17:44:00.2825549Z ##[debug]INPUT_APPLICATIONTYPENAME: 'YYYYYYYYYAdminApplicationType'
2019-04-05T17:44:00.2851562Z ##[debug]INPUT_VERSIONSTOKEEP: '25'
2019-04-05T17:44:00.2859654Z Hello Test
2019-04-05T17:44:00.2940936Z
2019-04-05T17:44:00.3971664Z ##[debug]Entering Connect-ServiceFabricClusterFromServiceEndpoint.
2019-04-05T17:44:00.4005857Z ##[debug] ClusterConnectionParameters: ''
2019-04-05T17:44:00.4049759Z ##[debug] ConnectedServiceEndpoint: '#{Url=tcp://XXXXXXX-dev.eastus.cloudapp.azure.com:19000/; Data=; Auth=}'
2019-04-05T17:44:00.4073037Z ##[debug]Loading module from path 'D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\TlsHelper_\TlsHelper_.psm1'.
2019-04-05T17:44:00.4131899Z ##[debug]Loading resource strings from: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\TlsHelper_/module.json
2019-04-05T17:44:00.4222463Z ##[debug]Loaded 3 strings.
2019-04-05T17:44:00.4254490Z ##[debug]SYSTEM_CULTURE: 'en-US'
2019-04-05T17:44:00.4276566Z ##[debug]Loading resource strings from: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\TlsHelper_\Strings\resources.resjson\en-US\resources.resjson
2019-04-05T17:44:00.4371091Z ##[debug]Loaded 3 strings.
2019-04-05T17:44:00.4389647Z ##[debug]Exporting function 'Add-Tls12InSession'.
2019-04-05T17:44:00.4408086Z ##[debug]Exporting function 'Assert-TlsError'.
2019-04-05T17:44:00.4427407Z ##[debug]Importing function 'Add-Tls12InSession'.
2019-04-05T17:44:00.4445734Z ##[debug]Importing function 'Assert-TlsError'.
2019-04-05T17:44:00.4468489Z ##[debug]Loading module from path 'D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\PowershellHelpers\PowershellHelpers.psm1'.
2019-04-05T17:44:00.4520413Z ##[debug]Loading resource strings from: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\PowershellHelpers\module.json
2019-04-05T17:44:00.4616048Z ##[debug]Loaded 3 strings.
2019-04-05T17:44:00.4644750Z ##[debug]SYSTEM_CULTURE: 'en-US'
2019-04-05T17:44:00.4665426Z ##[debug]Loading resource strings from: D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\PowershellHelpers\Strings\resources.resjson\en-US\resources.resjson
2019-04-05T17:44:00.4762919Z ##[debug]Loaded 3 strings.
2019-04-05T17:44:00.4815247Z ##[debug]Exporting function 'Invoke-ActionWithRetries'.
2019-04-05T17:44:00.4833170Z ##[debug]Exporting function 'Get-TempDirectoryPath'.
2019-04-05T17:44:00.4852570Z ##[debug]Importing function 'Get-TempDirectoryPath'.
2019-04-05T17:44:00.4869307Z ##[debug]Importing function 'Invoke-ActionWithRetries'.
2019-04-05T17:44:00.8779229Z ##[debug]TLS 1.2 already present in session.
2019-04-05T17:44:01.1396847Z ##[debug]Leaving Connect-ServiceFabricClusterFromServiceEndpoint.
2019-04-05T17:44:01.3539036Z ##[debug]Leaving D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\powershell.ps1.
2019-04-05T17:44:01.4231167Z ##[debug]Caught exception from task script.
2019-04-05T17:44:01.4260902Z ##[debug]Error record:
2019-04-05T17:44:01.4795495Z ##[debug]Cannot index into a null array.
2019-04-05T17:44:01.4807469Z ##[debug]At D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\Connect-ServiceFabricClusterFromServiceEndpoint.ps1:183 char:9
2019-04-05T17:44:01.4819503Z ##[debug]+ $clusterConnectionParameters["ConnectionEndpoint"] = $connect ...
2019-04-05T17:44:01.4833117Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-04-05T17:44:01.4845957Z ##[debug] + CategoryInfo : InvalidOperation: (:) [], RuntimeException
2019-04-05T17:44:01.4858471Z ##[debug] + FullyQualifiedErrorId : NullArray
2019-04-05T17:44:01.4871142Z ##[debug]
2019-04-05T17:44:01.4891780Z ##[debug]Script stack trace:
2019-04-05T17:44:01.4933518Z ##[debug]at Connect-ServiceFabricClusterFromServiceEndpoint, D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\ps_modules\ServiceFabricHelpers\Connect-ServiceFabricClusterFromServiceEndpoint.ps1: line 183
2019-04-05T17:44:01.4947432Z ##[debug]at <ScriptBlock>, D:\a\_tasks\CleanupServiceFabricApplicationVersions_5164728d-cfca-4576-a066-ZZZZZZZZZZZZ\0.0.10\powershell.ps1: line 33
2019-04-05T17:44:01.4961200Z ##[debug]at <ScriptBlock>, <No file>: line 1
2019-04-05T17:44:01.4976344Z ##[debug]at <ScriptBlock>, <No file>: line 22
2019-04-05T17:44:01.4991236Z ##[debug]at <ScriptBlock>, <No file>: line 18
2019-04-05T17:44:01.5004268Z ##[debug]at <ScriptBlock>, <No file>: line 1
2019-04-05T17:44:01.5024099Z ##[debug]Exception:
2019-04-05T17:44:01.5063789Z ##[debug]System.Management.Automation.RuntimeException: Cannot index into a null array.
2019-04-05T17:44:01.5078978Z ##[debug] at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
2019-04-05T17:44:01.5092694Z ##[debug] at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
2019-04-05T17:44:01.5107807Z ##[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2019-04-05T17:44:01.5120140Z ##[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2019-04-05T17:44:01.5414310Z ##[error]Cannot index into a null array.
2019-04-05T17:44:01.5423078Z ##[debug]Processed: ##vso[task.logissue type=error]Cannot index into a null array.
2019-04-05T17:44:01.5443902Z ##[debug]Processed: ##vso[task.complete result=Failed]
I have verified that all the required modules are included in the task & I am selecting the correct service fabric connection from the list.
Here is the powershell script that I am using to call the Connect-ServiceFabricClusterFromServiceEndpoint function:
Import-Module $PSScriptRoot\ps_modules\ServiceFabricHelpers
# Get inputs.
$inputName = Get-VstsInput -Name 'name' -Require
$serviceConnectionName = Get-VstsInput -Name serviceConnectionName -Require
$connectedServiceEndpoint = Get-VstsEndpoint -Name $serviceConnectionName -Require
$ApplicationTypeName = Get-VstsInput -Name 'ApplicationTypeName' -Require
$VersionsToKeep = Get-VstsInput -Name 'VersionsToKeep' -Require
Write-Host "Hello $inputName"
if ($connectedServiceEndpoint.Auth.Scheme -ne "None" -and !$connectedServiceEndpoint.Auth.Parameters.ServerCertThumbprint)
{
Write-Warning (Get-VstsLocString -Key ServiceEndpointUpgradeWarning)
if ($publishProfile)
{
$clusterConnectionParameters["ServerCertThumbprint"] = $publishProfile.ClusterConnectionParameters["ServerCertThumbprint"]
}
else
{
throw (Get-VstsLocString -Key PublishProfileRequiredServerThumbprint)
}
}
write-output $connectedServiceEndpoint
# Connect to cluster
$certificate = Connect-ServiceFabricClusterFromServiceEndpoint -ClusterConnectionParameters $clusterConnectionParameters -ConnectedServiceEndpoint $connectedServiceEndpoint
I am expecting the connection properties to be passed to Connect-ServiceFabricClusterFromServiceEndpoint function so that I can perform operation on the cluster.
Related
is there a way in Service Fabric to deploy a new version of an app even though the code hasn't changed?
SF is constantly complaining about this whenever the devs rebuild the repo because something outside of the package changed but don't change the actual code of the app, and the version of the application gets bumped up by the build pipeline.
SF then says "you're trying to deploy a newer version of an application that already exists even though there are no code changes" and then fails.
Any way to change this behaviour?
Edit:
Here's a trace of the actual deployment error:
2018-11-07T06:07:23.1289545Z ##[debug]Processed: ##vso[telemetry.publish
area=TaskHub;feature=ServiceFabricDeploy]{"OperationId":"GetApplicationType","ExceptionData":"System.Management.Automation.MethodInvocationException;System.Management.Automation.RuntimeException;System.Management.Automation.RuntimeException;|D:\\a\\_tasks\\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\\1.7.27\\ServiceFabricSDK\\Utilities.ps1|597","JobId":"ae65e85b-a04b-4de4-ac32-c9a821fba222","SDKVersion":"3.2.176.9494"}
2018-11-07T06:07:23.5491048Z ##[debug]Leaving D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\deploy.ps1.
2018-11-07T06:07:23.5537752Z ##[debug]Caught exception from task script.
2018-11-07T06:07:23.5570190Z ##[debug]Error record:
2018-11-07T06:07:23.6347435Z ##[debug]Invoke-ActionWithRetries : Exception calling "Invoke" with "1" argument(s): "Failed to register application type. Status: Failed. Details: FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR: The content in CodePackage Name:Code and Version:1.0.0.18275.02 in Service Manifest 'App.ApiGateway.WebApiPkg' has changed, but the version number is the same.."
2018-11-07T06:07:23.6359357Z ##[debug]At D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\ServiceFabricSDK\Utilities.ps1:597 char:12
2018-11-07T06:07:23.6371643Z ##[debug]+ return Invoke-ActionWithRetries -Action $getAppTypeAction `
2018-11-07T06:07:23.6383668Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-11-07T06:07:23.6395763Z ##[debug] + CategoryInfo : NotSpecified: (:) [Invoke-ActionWithRetries], MethodInvocationException
2018-11-07T06:07:23.6408095Z ##[debug] + FullyQualifiedErrorId : RuntimeException,Invoke-ActionWithRetries
2018-11-07T06:07:23.6420176Z ##[debug]
2018-11-07T06:07:23.6439430Z ##[debug]Script stack trace:
2018-11-07T06:07:23.6475478Z ##[debug]at Invoke-ActionWithRetries, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\ps_modules\PowershellHelpers\Helpers.ps1: line 61
2018-11-07T06:07:23.6487812Z ##[debug]at Wait-ServiceFabricApplicationTypeRegistrationStatus, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\ServiceFabricSDK\Utilities.ps1: line 597
2018-11-07T06:07:23.6500061Z ##[debug]at Register-ServiceFabricApplicationTypeAction, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\ServiceFabricSDK\Utilities.ps1: line 516
2018-11-07T06:07:23.6512541Z ##[debug]at Publish-NewServiceFabricApplication, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1: line 296
2018-11-07T06:07:23.6524254Z ##[debug]at <ScriptBlock>, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.7.27\deploy.ps1: line 194
2018-11-07T06:07:23.6536298Z ##[debug]at <ScriptBlock>, <No file>: line 1
2018-11-07T06:07:23.6548158Z ##[debug]at <ScriptBlock>, <No file>: line 22
2018-11-07T06:07:23.6559801Z ##[debug]at <ScriptBlock>, <No file>: line 18
2018-11-07T06:07:23.6572215Z ##[debug]at <ScriptBlock>, <No file>: line 1
2018-11-07T06:07:23.6591191Z ##[debug]Exception:
2018-11-07T06:07:23.6634400Z ##[debug]System.Management.Automation.MethodInvocationException: Exception calling "Invoke" with "1" argument(s): "Failed to register application type. Status: Failed. Details: FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR: The content in CodePackage Name:Code and Version:1.0.0.18275.02 in Service Manifest 'App.ApiGateway.WebApiPkg' has changed, but the version number is the same.." ---> System.Management.Automation.RuntimeException: Failed to register application type. Status: Failed. Details: FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR: The content in CodePackage Name:Code and Version:1.0.0.18275.02 in Service Manifest 'App.ApiGateway.WebApiPkg' has changed, but the version number is the same.. ---> System.Management.Automation.RuntimeException: Failed to register application type. Status: Failed. Details: FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR: The content in CodePackage Name:Code and Version:1.0.0.18275.02 in Service Manifest 'App.ApiGateway.WebApiPkg' has changed, but the version number is the same..
2018-11-07T06:07:23.6646133Z ##[debug] --- End of inner exception stack trace ---
2018-11-07T06:07:23.6657929Z ##[debug] at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
2018-11-07T06:07:23.6670688Z ##[debug] at <ScriptBlock>(Closure , FunctionContext )
2018-11-07T06:07:23.6683139Z ##[debug] at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
2018-11-07T06:07:23.6694796Z ##[debug] at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.<InvokeWithPipe>b__0()
2018-11-07T06:07:23.6707020Z ##[debug] at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
2018-11-07T06:07:23.6719153Z ##[debug] at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
2018-11-07T06:07:23.6731325Z ##[debug] at System.Management.Automation.ScriptBlock.DoInvoke(Object dollarUnder, Object input, Object[] args)
2018-11-07T06:07:23.6742915Z ##[debug] at CallSite.Target(Closure , CallSite , ScriptBlock , Object )
2018-11-07T06:07:23.6754590Z ##[debug] --- End of inner exception stack trace ---
2018-11-07T06:07:23.6766838Z ##[debug] at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
2018-11-07T06:07:23.6778543Z ##[debug] at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
2018-11-07T06:07:23.6791071Z ##[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2018-11-07T06:07:23.6802711Z ##[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2018-11-07T06:07:23.6814797Z ##[debug] at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
2018-11-07T06:07:23.6826406Z ##[debug] at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
2018-11-07T06:07:23.6838645Z ##[debug] at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
2018-11-07T06:07:23.6850253Z ##[debug] at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
2018-11-07T06:07:23.6862534Z ##[debug] at System.Management.Automation.CommandProcessorBase.Complete()
2018-11-07T06:07:23.6921240Z ##[error]Exception calling "Invoke" with "1" argument(s): "Failed to register application type. Status: Failed. Details: FABRIC_E_IMAGEBUILDER_VALIDATION_ERROR: The content in CodePackage Name:Code and Version:1.0.0.18275.02 in Service Manifest 'App.ApiGateway.WebApiPkg' has changed, but the version number is the same.."
In AzDo / VSTS the option "Use Diff Package" on the "Service Fabric Application Deployment" task is set.
This has been already answered here and here
You should make differencial packaging instead, or update the version of all services.
Answering the main question:
No, it's not possible to change this behaviour, you have to update the versions or do differential packaging.
I have created a Powershell function to enable or disable session logons remotely on a server. It is basically the Powershell equivalent of "change logon /enable".
It works on most machines, but for some reason I don't understand, for some it returns the following error :
Exception : System.Management.Automation.MethodInvocationException: Exception calling "Put" with "0" argument(s): "" ---> System.IO.FileNotFoundException
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Management.ManagementObject.Put(PutOptions options)
at System.Management.ManagementObject.Put()
at Put(Object , Object[] )
at System.Management.Automation.MethodInformation.Invoke(Object target, Object[] arguments)
at System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[]
originalArguments)
--- End of inner exception stack trace ---
at System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[]
originalArguments)
at System.Management.Automation.DotNetAdapter.MethodInvokeDotNet(String methodName, Object target, MethodInformation[] methodInformation,
PSMethodInvocationConstraints invocationConstraints, Object[] arguments)
at System.Management.Automation.DotNetAdapter.MethodInvoke(PSMethod method, PSMethodInvocationConstraints invocationConstraints, Object[] arguments)
at System.Management.Automation.Adapter.BaseMethodInvoke(PSMethod method, PSMethodInvocationConstraints invocationConstraints, Object[] arguments)
at System.Management.Automation.PSMethod.Invoke(PSMethodInvocationConstraints invocationConstraints, Object[] arguments)
at System.Management.Automation.PSMethod.Invoke(Object[] arguments)
at System.Management.Automation.Language.PSInvokeMemberBinder.InvokeAdaptedMember(Object obj, String methodName, Object[] args)
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject :
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : DotNetMethodException
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
The error stack trace doesn't help me.
I'm running the same code with the same local admin user on all machines.
Here is the actual code snippet :
$TSConnector = Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace "root/cimv2/terminalservices" -Authentication PacketPrivacy
$TSConnector.Logons = 0
$TSConnector.Put()
Any idea ?
So it turns out that, on Windows Server 2008R2, if the Remote Desktop Session Host role is not installed, the server is configured for "Remote Desktop for Administration".
As explained on this technet article :
The following are limitations of Remote Desktop for Administration:
The default connection (RDP-Tcp) only allows a maximum of two simultaneous remote connections.
Licensing settings cannot be configured.
RD Connection Broker settings cannot be configured.
User logon mode cannot be configured.
So in the end I had to catch that exception and revert back to using change logon /disable in that particular case.
Kudos to #GrigorySergeev for pointing me in the right direction!
Is there a way to update the contents of an existing iFile? I didn't see any way to update the contents. So, I started looking at deleting and creating a file by uploading a local file to the BigIP using the iControl. I understand there are two objects to use - iFileFile and then iFile in that order.
Can somebody please provide usage for this? Below is what I started with and get the error below. What would be the correct parameters for iFileFile.create() if I have a file named random_key_file1 in the same location as the powershell script? After creating the iFileFile object, how do I use the same in the iFile.create().
Below links have documentation but lack the ussage examples : https://devcentral.f5.com/wiki/iControl.LocalLB__iFile__create.ashx https://devcentral.f5.com/wiki/iControl.LocalLB__iFileFile__create.ashx
Appreciate the help.
Add-PSSnapIn iControlSnapIn
$conn = Initialize-F5.iControl -HostName $hostName -Username $username -Password $password
if($conn) {
Try
{
Write-Output "Connected to load balancer - $hostName"
$ic = Get-F5.iControl
$iFileFileObjectNames = #("file1")
$filePaths = #("random_key_file1")
$ic.LocalLBiFileFile.create($iFileFileObjectNames,$filePaths)
Write-Output ("file created")
}
Catch
{
Write-Output($error[0]|format-list -force)
}
}
else
{
Write-Error "Connection to loadbalancer failed"
}
ERROR
Exception : System.Management.Automation.MethodInvocationException: Exception calling "create" with "2"
argument(s): "Exception caught in LocalLB::urn:iControl:LocalLB/iFileFile::create()
Common::InvalidArgument
" ---> System.Web.Services.Protocols.SoapHeaderException: Exception caught in
LocalLB::urn:iControl:LocalLB/iFileFile::create()
Common::InvalidArgument
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[]
parameters)
at CallSite.Target(Closure , CallSite , Object , Object , Object )
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext
funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame
frame)
at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
TargetObject :
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : SoapHeaderException
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, D:\test.ps1: line 35
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
PSMessageDetails :
Answer this Question 0
I have a method named GoLogon in a COM object named BS.Logon which requires 5 parameters:
Username
Password
ApplicationID
XMLRoot
IPAddress
This method logins to the web server with the username, password, and other details, and returns the session ID.
I have written the Powershell script to call the method GoLogon as below.
$obj=New-Object -ComObject BS.Logon
$sessionid=$obj.GoLogon([ref]$bUsername,$bPassword,$appid,$xmlroot,[ref]$ipad)
Write-Host $sessionid
When the script is executed, the method makes successful login. I can see the session ID details in the database, but I am not able to get the session ID details through script. The variable $sessionid returns null. Also the script throws exception as
Exception calling "GoLogon" with "5" argument(s): "Invalid callee. (Exception from HRESULT: 0x80020010 (DISP_E_BADCALLEE))"
At E:\Logon.ps1:18 char:1
+ $obj.Login([ref]$bUsername,$bPassword,$appid,$xmlroot,[ref]$ipad)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation`
The stacktrace is:
Exception : System.Management.Automation.MethodInvocationException: Exception calling "GoLogon" with "5" argument(s): "Invalid callee. (Exception from HRESULT: 0x80020010 (DISP_E_BADCALLEE))" ---> System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Invalid callee. (Exception from HRESULT: 0x80020010 (DISP_E_BADCALLEE))
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Management.Automation.ComMethod.InvokeMethod(PSMethod method, Object[] arguments)
--- End of inner exception stack trace ---
at System.Management.Automation.ComMethod.InvokeMethod(PSMethod method, Object[] arguments)
at System.Management.Automation.Adapter.BaseMethodInvoke(PSMethod method, PSMethodInvocationConstraints invocationConstraints, Object[] arguments)
at System.Dynamic.UpdateDelegates.UpdateAndExecute6[T0,T1,T2,T3,T4,T5,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
at System.Management.Automation.Interpreter.DynamicInstruction 7.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject :
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : ComMethodTargetInvocation
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, E:\Logon.ps1: line 18
PipelineIterationInfo : {}
PSMessageDetails :
Please suggest me how to get the session ID value from the method.
PowerShell seems to have a problem with COM parameters defined as VARIANT.
This is the case here, as the C++ signature of GoLogon suggests.
STDMETHODIMP CLOG::GOLogon(VARIANT *pvEmailId, BSTR bsPassword, BSTR bsIPAddress, BSTR bsSoloBuildVer, VARIANT *pvXML, BSTR *bsSessionId)
The answer suggested in this post "Invalid callee" calling a com object is to use a VariantWrapper.
In you case this should do the trick.
#define VariantWrapper for variables to be passesed as VARIANT
$wrapbUservame = New-Object Runtime.InteropServices.VariantWrapper($bUsername)
$wrappvXML = New-Object Runtime.InteropServices.VariantWrapper($pvXML)
#pass a [ref]VariantWrapper to .COM method
$sessionid=$obj.GoLogon([ref]$wrapbUservame,$bPassword,$appid,[ref]$wrappvXML,$ipad)
I've tried the scripts which hugh posted here: PowerShell BizTalk scripts WITHOUT using BizTalk provider for PowerShell
It almost worked perfectly... Except for the Create-BTS-SendHandler-part...
I keep getting a strange error:
Exception calling "Invoke" with "2" argument(s): "Failed during call to one of administration components."
At line:22 char:23
+ $methodInfo.Invoke <<<< ($objSendHandler, $putOptions)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodTargetInvocation
$error[0]|Format-List -Force gives this:
System.Management.Automation.MethodInvocationException: Exception calling "Invoke" with "2" argument(s): "Failed during call to one of administration components." ---> System.Runtime.InteropServices.COMExcep tion (0xC0C02306): Failed during call to one of administration components.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Management.ManagementObject.Put(PutOptions options)
--- End of inner exception stack trace ---
at System.Management.Automation.DotNetAdapter.AuxiliaryMethodInvoke(Object target, Object[] arguments, MethodInformation methodInformation, Object[] originalArguments)
at System.Management.Automation.DotNetAdapter.MethodInvokeDotNet(String methodName, Object target, MethodInformation[] methodInformation, Object[] arguments)
at System.Management.Automation.DotNetAdapter.MethodInvoke(PSMethod method, Object[] arguments)
at System.Management.Automation.Adapter.BaseMethodInvoke(PSMethod method, Object[] arguments)
at System.Management.Automation.PSMethod.Invoke(Object[] arguments)
at System.Management.Automation.ParserOps.CallMethod(Token token, Object target, String methodName, Object[] paramArray, Boolean callStatic, Object valueToSet)
at System.Management.Automation.MethodCallNode.InvokeMethod(Object target, Object[] arguments, Object value)
at System.Management.Automation.MethodCallNode.Execute(Array input, Pipe outputPipe, ExecutionContext context)
at System.Management.Automation.ParseTreeNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
at System.Management.Automation.StatementListNode.ExecuteStatement(ParseTreeNode statement, Array input, Pipe outputPipe, ArrayList& resultList, ExecutionContext context)
TargetObject :
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : DotNetMethodTargetInvocation
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
PipelineIterationInfo : {}
PSMessageDetails :
I have tried to use both x86 and normal ISE to make sure it is not related to 32-bit. I've also checked that I have the rights to create Send-Handlers.
Any one who has an idea?
/Joakim
You need to use the proper names for BizTalk adapters, as specified in the
Platform Settings -> Adapters
list in BizTalk administrator. These are case sensitive.