Deploy Service Fabric Application through VSTS release pipeline using Hosted Agent - azure

I have set up continuous integration using Hosted Agent for service fabric by following this document https://azure.microsoft.com/en-us/documentation/articles/service-fabric-set-up-continuous-integration/
In Release pipeline after importing certificate I am getting the following error and deployment failing. I am not able to identify where the issue is
[error]An error occurred during this operation. Please check the trace logs for more details.
Finishing task: ServiceFabricDeploy
[error]System.Exception: Task ServiceFabricDeploy failed.
This caused the job to fail. Look at the logs for the task for more details.
[error] at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.Run(IJobContext jobContext, IJobRequest job, IJobExtension jobExtension, CancellationTokenSource tokenSource)
Under Deploy service fabric task it is showing the below error
Imported cluster client certificate with thumbprint 'A6B32E70CFE715F608A247C1ED94AB3D0164A58E'.
Thumbprint Subject
A6B32E70CFE715F608A247C1ED94AB3D0164A58E >CN=clusternamedns.eastus.cloudapp.azure.com
[error]An error occurred during this operation. Please check the trace logs for more details.
Update
After setting system.debug to true in variables, I got the following log
2016-08-03T05:44:31.6556865Z ##[debug]System.Fabric.FabricException: An error occurred during this operation. Please check the trace logs for more details. ---> System.Runtime.InteropServices.COMException: No credentials are available in the security package (Exception from HRESULT: 0x8009030E)
2016-08-03T05:44:31.6566887Z ##[debug] at System.Fabric.Interop.NativeClient.IFabricClientSettings2.SetSecurityCredentials(FABRIC_SECURITY_CREDENTIALS credentials)
2016-08-03T05:44:31.6577063Z ##[debug] at System.Fabric.FabricClient.SetSecurityCredentialsInternal(SecurityCredentials credentials)
2016-08-03T05:44:31.6587072Z ##[debug] at System.Fabric.Interop.Utility.WrapNativeSyncInvoke[TResult](Func`1 func, String functionTag, String functionArgs)
2016-08-03T05:44:31.6597111Z ##[debug] --- End of inner exception stack trace ---
2016-08-03T05:44:31.6606871Z ##[debug] at System.Fabric.Interop.Utility.RunInMTA[TResult](Func`1 func)
2016-08-03T05:44:31.6647953Z ##[debug] at System.Fabric.FabricClient.InitializeFabricClient(SecurityCredentials credentialArg, FabricClientSettings newSettings, String[] hostEndpointsArg)
2016-08-03T05:44:31.6656886Z ##[debug] at Microsoft.ServiceFabric.Powershell.ClusterConnection.FabricClientBuilder.Build()
2016-08-03T05:44:31.6666879Z ##[debug] at Microsoft.ServiceFabric.Powershell.ClusterConnection..ctor(FabricClientBuilder fabricClientBuilder, Boolean getMetadata)
2016-08-03T05:44:31.6676869Z ##[debug] at Microsoft.ServiceFabric.Powershell.ConnectCluster.ProcessRecord()
2016-08-03T05:44:31.6770225Z ##[debug]Leaving C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.103.1\tasks\ServiceFabricDeploy\1.0.1\deploy.ps1.
2016-08-03T05:44:31.6850322Z ##[debug]Caught exception from task script.
2016-08-03T05:44:31.6890370Z ##[debug]Error record:
2016-08-03T05:44:31.7380329Z ##[debug]Connect-ServiceFabricCluster : An error occurred during this operation. Please check the trace logs for more details.
2016-08-03T05:44:31.7390333Z ##[debug]At C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.103.1\tasks\ServiceFabricDeploy\1.0.1\deploy.ps1:73 char:12
2016-08-03T05:44:31.7410325Z ##[debug]+ [void](Connect-ServiceFabricCluster #clusterConnectionParameters)
2016-08-03T05:44:31.7420325Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2016-08-03T05:44:31.7430323Z ##[debug] + CategoryInfo : InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricException
2016-08-03T05:44:31.7440363Z ##[debug] + FullyQualifiedErrorId : CreateClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.ConnectCluster
2016-08-03T05:44:31.7450426Z ##[debug]
2016-08-03T05:44:31.7470318Z ##[debug]Script stack trace:
2016-08-03T05:44:31.7500512Z ##[debug]at <ScriptBlock>, C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.103.1\tasks\ServiceFabricDeploy\1.0.1\deploy.ps1: line 73
2016-08-03T05:44:31.7910331Z ##[debug]at <ScriptBlock>, <No file>: line 1
2016-08-03T05:44:31.7920318Z ##[debug]at <ScriptBlock>, <No file>: line 22
2016-08-03T05:44:31.7930364Z ##[debug]at <ScriptBlock>, <No file>: line 18
2016-08-03T05:44:31.7940315Z ##[debug]at <ScriptBlock>, <No file>: line 1
2016-08-03T05:44:31.7960349Z ##[debug]Exception:
2016-08-03T05:44:31.8000522Z ##[debug]System.Fabric.FabricException: An error occurred during this operation. Please check the trace logs for more details. ---> System.Runtime.InteropServices.COMException: No credentials are available in the security package (Exception from HRESULT: 0x8009030E)
2016-08-03T05:44:31.8010571Z ##[debug] at System.Fabric.Interop.NativeClient.IFabricClientSettings2.SetSecurityCredentials(FABRIC_SECURITY_CREDENTIALS credentials)
2016-08-03T05:44:31.8020684Z ##[debug] at System.Fabric.FabricClient.SetSecurityCredentialsInternal(SecurityCredentials credentials)
2016-08-03T05:44:31.8030335Z ##[debug] at System.Fabric.Interop.Utility.WrapNativeSyncInvoke[TResult](Func`1 func, String functionTag, String functionArgs)
2016-08-03T05:44:31.8040334Z ##[debug] --- End of inner exception stack trace ---
2016-08-03T05:44:31.8060326Z ##[debug] at System.Fabric.Interop.Utility.RunInMTA[TResult](Func`1 func)
2016-08-03T05:44:31.8070343Z ##[debug] at System.Fabric.FabricClient.InitializeFabricClient(SecurityCredentials credentialArg, FabricClientSettings newSettings, String[] hostEndpointsArg)
2016-08-03T05:44:31.8080330Z ##[debug] at Microsoft.ServiceFabric.Powershell.ClusterConnection.FabricClientBuilder.Build()
2016-08-03T05:44:31.8090325Z ##[debug] at Microsoft.ServiceFabric.Powershell.ClusterConnection..ctor(FabricClientBuilder fabricClientBuilder, Boolean getMetadata)
2016-08-03T05:44:31.8100358Z ##[debug] at Microsoft.ServiceFabric.Powershell.ConnectCluster.ProcessRecord()
2016-08-03T05:44:31.8340330Z ##[error]An error occurred during this operation. Please check the trace logs for more details.

The below PowerShell scripts help in converting the PFX file to Base64 string. It outputs the string to a text file.
$fileContentBytes = get-content 'C:\<your-certificate>.pfx' -Encoding Byte
[System.Convert]::ToBase64String($fileContentBytes) | Out-File 'C:\pfx-bytes.txt'
However, when you open the file (that contains Base64 string) in notepad and do a select all (CTRL + A) operation, an extra line (break) at the end of the file gets copied. This extra line gets pasted while adding the Client certificate during the creation of Cluster Service Connection for the task Service Fabric Application Deployment.
Delete that extra line and it should work. I hope this answer helps as well.

narendramacha
I think the problem here could be that you are using the Base64 of the cer certificate file on the SF endpoint, rather than Base64 of the PFX file (which is normally protected by a password).

Related

Azure DevOps, Pipeline error ##[warning]Couldn't find a debug log in the cache or working directory JsNode

I am trying to upload my JS app into Azure DevOps and during the running pipeline, I'm getting an error on the NPM build stage. ##[warning]Couldn't find a debug log in the cache or working directory. I believe this is the reason why NPM build is failing,
##[debug]Processed: ##vso[task.issue type=error;]Error: Npm failed with return code: 1
Did anyone have a similar problem? any clues?
Below are logs.
##[debug]findPath: 'C:\npm\cache\_logs'
##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
##[debug]findOptions.followSymbolicLinks: 'true'
##[debug] C:\npm\cache\_logs (directory)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_45_496Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_46_269Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_47_005Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_47_757Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_48_499Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_49_272Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_50_016Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_50_833Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_51_628Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_52_416Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_53_188Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_54_118Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_55_141Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_55_976Z-debug-0.log (file)
##[debug] C:\npm\cache\_logs\2022-06-09T09_03_56_789Z-debug-0.log (file)
##[debug]16 results
##[debug]found 16 paths
##[debug]applying include pattern
##[debug]adjustedPattern: 'C:\npm\cache\_logs\*-debug.log'
##[debug]0 matches
##[debug]0 final results
##[debug]Trying debug log location: D:\a\1\s\npm-debug.log
##[warning]Couldn't find a debug log in the cache or working directory**
##[debug]Processed: ##vso[task.issue type=warning;]Couldn't find a debug log in the cache or
working directory
##[debug]Agent.BuildDirectory=D:\a\1
##[debug]rm -rf D:\a\1\npm
##[debug]removing directory D:\a\1\npm
##[debug]task result: Failed
##[error]Error: Npm failed with return code: 1
##[debug]Processed: ##vso[task.issue type=error;]Error: Npm failed with return code: 1
##[debug]Processed: ##vso[task.complete result=Failed;]Error: Npm failed with return code: 1
Finishing: npm build
Try to delete package-lock.json file and re excute your pipeline

Azure Storage Emulator returns 500 internal server error

I have an application that uses Azure Storage, when I have reinstalled the Azure Storage Emulator and Explorer and then run the app, I get this error.
The app was working before I reinstalled.
[WebException: The remote server returned an error: (500) Internal Server Error.]
Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase`1 cmd, Exception ex) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\Common\Shared\Protocol\HttpResponseParsers.Common.cs:54
Microsoft.WindowsAzure.Storage.Blob.<>c__DisplayClass57.<PutBlobImpl>b__56(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Blob\CloudBlockBlob.cs:3132
Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse(IAsyncResult getResponseResult) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:300
[StorageException: The remote server returned an error: (500) Internal Server Error.]
Microsoft.WindowsAzure.Storage.Core.Util.StorageAsyncResult`1.End() in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Util\StorageAsyncResult.cs:77
Microsoft.WindowsAzure.Storage.Core.Util.<>c__DisplayClass7.<CreateCallbackVoid>b__5(IAsyncResult ar) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Util\AsyncExtensions.cs:121
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
Microsoft.AspNetCore.DataProtection.AzureStorage.<StoreElementAsync>d__14.MoveNext() +1308
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
Microsoft.AspNetCore.DataProtection.AzureStorage.AzureBlobXmlRepository.StoreElement(XElement element, String friendlyName) +161
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IInternalXmlKeyManager.CreateNewKey(Guid keyId, DateTimeOffset creationDate, DateTimeOffset activationDate, DateTimeOffset expirationDate) +1493
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.CreateNewKey(DateTimeOffset activationDate, DateTimeOffset expirationDate) +150
Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore(DateTimeOffset now, IKey keyJustAdded) +645
Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.ICacheableKeyRingProvider.GetCacheableKeyRing(DateTimeOffset now) +12
Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore(DateTime utcNow) +517
Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect(Byte[] plaintext) +90
[WebException: The remote server returned an error: (500) Internal
Server Error.]
One of the workaround you may follow to resolve the above issue:
Try to rename the application name with some other name and restart the azure storage emulator(>run AzureStorageEmulator.exe start) and run the application.
Alternatively to resolve with Azure storage explorer please find this SO THREAD as suggested by #Seth .
For more information you can refer this SO THREAD .

Azure file copy Task - [error]Object reference not set to an instance of an object

Within Azure DevOps I have a release pipeline that uses the Azure file copy # version 2.154.19 to copy some files to blob storage.
Recently, the task started to fail with the following error in the logs:
2020-02-03T11:15:33.0304141Z ##[error]Object reference not set to an instance of an object.
The full task logs from Azure DevOps are as follows
2020-02-03T11:15:14.5316566Z ##[section]Starting: AzureBlob File Copy
2020-02-03T11:15:14.5429010Z ==============================================================================
2020-02-03T11:15:14.5429097Z Task : Azure file copy
2020-02-03T11:15:14.5429168Z Description : Copy files to Azure Blob Storage or virtual machines
2020-02-03T11:15:14.5429219Z Version : 2.154.19
2020-02-03T11:15:14.5429281Z Author : Microsoft Corporation
2020-02-03T11:15:14.5429338Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy
2020-02-03T11:15:14.5429551Z ==============================================================================
2020-02-03T11:15:17.6071596Z ##[command]Import-Module -Name C:\Modules\azurerm_2.1.0\AzureRM\2.1.0\AzureRM.psd1 -Global
2020-02-03T11:15:29.5994320Z ##[warning]The names of some imported commands from the module 'AzureRM.Websites' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
2020-02-03T11:15:29.6177486Z ##[command]Import-Module -Name C:\Modules\azurerm_2.1.0\AzureRM.Profile\2.1.0\AzureRM.Profile.psm1 -Global
2020-02-03T11:15:30.0756632Z ##[command]Add-AzureRMAccount -ServicePrincipal -Tenant *** -Credential System.Management.Automation.PSCredential -EnvironmentName AzureCloud #processScope
2020-02-03T11:15:31.2123104Z ##[command] Select-AzureRMSubscription -SubscriptionId 4fc034ca-6877-4bfd-83a6-5ffe29608da5 -TenantId ***
2020-02-03T11:15:33.0304141Z ##[error]Object reference not set to an instance of an object.
2020-02-03T11:15:33.0638228Z ##[section]Finishing: AzureBlob File Copy
The configuration for the task is as follows:
Nothing has changed recently but this task now seems to be failing.
I've set the variable system.debug to true and now I get the following logs:
2020-02-04T13:12:06.4274088Z ##[debug]Validating minimum required azure powershell version is greater than or equal to 0.9.0
2020-02-04T13:12:06.4332040Z ##[debug]Populating RepositorySourceLocation property for module AzureRM.
2020-02-04T13:12:06.4360442Z ##[debug]Loading module from path 'C:\Modules\azurerm_2.1.0\AzureRM\2.1.0\AzureRM.psm1'.
2020-02-04T13:12:06.4556756Z ##[debug]Installed Azure PowerShell version: 2.1.0
2020-02-04T13:12:06.4579801Z ##[debug]Compare azure versions: 2.1.0, 0.9.0
2020-02-04T13:12:06.4599735Z ##[debug]Validated the required azure powershell version is greater than or equal to 0.9.0
2020-02-04T13:12:06.4685961Z ##[debug][Azure Call]Getting resource details for azure storage account resource: xxx221 with resource type: Microsoft.Storage/storageAccounts
2020-02-04T13:12:07.0852040Z ##[debug]System.NullReferenceException: Object reference not set to an instance of an object.
2020-02-04T13:12:07.0865383Z ##[debug] at Microsoft.Azure.Commands.Management.Storage.Models.PSStorageAccount..ctor(StorageAccount storageAccount) in d:\workspace\powershell-sign\src\ResourceManager\Storage\Commands.Management.Storage\Models\PSStorageAccount.cs:line 27
2020-02-04T13:12:07.0880480Z ##[debug] at Microsoft.Azure.Commands.Management.Storage.Models.PSStorageAccount.Create(StorageAccount storageAccount, IStorageManagementClient client) in d:\workspace\powershell-sign\src\ResourceManager\Storage\Commands.Management.Storage\Models\PSStorageAccount.cs:line 87
2020-02-04T13:12:07.0894045Z ##[debug] at Microsoft.Azure.Commands.Management.Storage.StorageAccountBaseCmdlet.<>c__DisplayClass2.<WriteStorageAccountList>b__1(StorageAccount storageAccount) in d:\workspace\powershell-sign\src\ResourceManager\Storage\Commands.Management.Storage\StorageAccount\StorageAccountBaseCmdlet.cs:line 161
2020-02-04T13:12:07.0908039Z ##[debug] at Microsoft.WindowsAzure.Commands.Utilities.Common.GeneralUtilities.ForEach[T](IEnumerable`1 sequence, Action`1 action) in d:\workspace\powershell-sign\src\Common\Commands.Common\GeneralUtilities.cs:line 147
2020-02-04T13:12:07.0923496Z ##[debug] at Microsoft.Azure.Commands.Management.Storage.StorageAccountBaseCmdlet.WriteStorageAccountList(IEnumerable`1 storageAccounts) in d:\workspace\powershell-sign\src\ResourceManager\Storage\Commands.Management.Storage\StorageAccount\StorageAccountBaseCmdlet.cs:line 161
2020-02-04T13:12:07.0938702Z ##[debug] at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() in d:\workspace\powershell-sign\src\Common\Commands.Common\AzurePSCmdlet.cs:line 610
2020-02-04T13:12:07.1882171Z ##[debug]Processed: ##vso[task.logissue type=error;code={"Task_Internal_Error":"TemporaryCopyingToBlobContainerFailed"};]
2020-02-04T13:12:07.1928893Z ##[debug]Trying to disconnect from Azure and clear context at process scope
2020-02-04T13:12:07.4018399Z ##[debug]Caught exception from task script.
2020-02-04T13:12:07.4054453Z ##[debug]Error record:
2020-02-04T13:12:07.4764182Z ##[debug]Get-AzureRmStorageAccount : Object reference not set to an instance of an object.
2020-02-04T13:12:07.4779906Z ##[debug]At D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\AzureUtilityGTE1.0.ps1:27 char:47
2020-02-04T13:12:07.4795063Z ##[debug]+ ... ResourceDetails = Get-AzureRmStorageAccount -ErrorAction Stop | Where ...
2020-02-04T13:12:07.4809226Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-02-04T13:12:07.4822827Z ##[debug] + CategoryInfo : CloseError: (:) [Get-AzureRmStorageAccount], NullReferenceException
2020-02-04T13:12:07.4836831Z ##[debug] + FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand
2020-02-04T13:12:07.4851249Z ##[debug]
2020-02-04T13:12:07.4876156Z ##[debug]Script stack trace:
2020-02-04T13:12:07.4914114Z ##[debug]at Get-AzureStorageAccountResourceGroupName, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\AzureUtilityGTE1.0.ps1: line 27
2020-02-04T13:12:07.4926798Z ##[debug]at Get-AzureStorageKeyFromARM, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\AzureUtilityRest.ps1: line 28
2020-02-04T13:12:07.4942375Z ##[debug]at Get-StorageKey, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\Utility.ps1: line 149
2020-02-04T13:12:07.4955473Z ##[debug]at <ScriptBlock>, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\AzureFileCopy.ps1: line 101
2020-02-04T13:12:07.4968797Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-02-04T13:12:07.4982585Z ##[debug]at <ScriptBlock>, <No file>: line 22
2020-02-04T13:12:07.4996709Z ##[debug]at <ScriptBlock>, <No file>: line 18
2020-02-04T13:12:07.5010393Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-02-04T13:12:07.5033417Z ##[debug]Exception:
2020-02-04T13:12:07.5059409Z ##[debug]System.NullReferenceException: Object reference not set to an instance of an object.
2020-02-04T13:12:07.5073947Z ##[debug] at Microsoft.Azure.Commands.Management.Storage.Models.PSStorageAccount..ctor(StorageAccount storageAccount) in d:\workspace\powershell-sign\src\ResourceManager\Storage\Commands.Management.Storage\Models\PSStorageAccount.cs:line 27
2020-02-04T13:12:07.5086710Z ##[debug] at Microsoft.Azure.Commands.Management.Storage.Models.PSStorageAccount.Create(StorageAccount storageAccount, IStorageManagementClient client) in d:\workspace\powershell-sign\src\ResourceManager\Storage\Commands.Management.Storage\Models\PSStorageAccount.cs:line 87
2020-02-04T13:12:07.5104212Z ##[debug] at Microsoft.Azure.Commands.Management.Storage.StorageAccountBaseCmdlet.<>c__DisplayClass2.<WriteStorageAccountList>b__1(StorageAccount storageAccount) in d:\workspace\powershell-sign\src\ResourceManager\Storage\Commands.Management.Storage\StorageAccount\StorageAccountBaseCmdlet.cs:line 161
2020-02-04T13:12:07.5119770Z ##[debug] at Microsoft.WindowsAzure.Commands.Utilities.Common.GeneralUtilities.ForEach[T](IEnumerable`1 sequence, Action`1 action) in d:\workspace\powershell-sign\src\Common\Commands.Common\GeneralUtilities.cs:line 147
2020-02-04T13:12:07.5133721Z ##[debug] at Microsoft.Azure.Commands.Management.Storage.StorageAccountBaseCmdlet.WriteStorageAccountList(IEnumerable`1 storageAccounts) in d:\workspace\powershell-sign\src\ResourceManager\Storage\Commands.Management.Storage\StorageAccount\StorageAccountBaseCmdlet.cs:line 161
2020-02-04T13:12:07.5148324Z ##[debug] at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() in d:\workspace\powershell-sign\src\Common\Commands.Common\AzurePSCmdlet.cs:line 610
2020-02-04T13:12:07.5213129Z ##[error]Object reference not set to an instance of an object.
2020-02-04T13:12:07.5213434Z ##[debug]Processed: ##vso[task.logissue type=error]Object reference not set to an instance of an object.
2020-02-04T13:12:07.5222027Z ##[debug]Processed: ##vso[task.complete result=Failed]
2020-02-04T13:12:07.5808798Z ##[section]Finishing: AzureBlob File Copy
Is there any better debugging that I can enable for Azure DevOps tasks?
Hey Kevin if you want to get debug information in a release definition create a variable system.debug and set it to true. I just took a look at github and there is an open issue with the same error message for the v2 version of the task.
I would run it with debug, to see if its the same issue and then try the v3 version of the task.

azure service fabric vsts release (deployment) error Application type of application '' doesn't match the application type

Getting this error:
Application type of application '' doesn't match the application type in the application manifest of the new application package. Please ensure that the application being upgraded has the same application type.
My application is small and contains only 2 services. If I deploy manually from Visual Studio 2017 it's working fine. But when I deploy from a successful build in VSTS I'm getting the above error. I used the same publish profile both in manual and vsts release.
Any idea?
Additional details from the logs:
2017-06-06T16:00:59.2449160Z ##[debug]INPUT_OVERRIDEPUBLISHPROFILESETTINGS: 'false'
2017-06-06T16:01:00.9096138Z ##[debug]Join-Path "C:\Program Files\Microsoft Service Fabric\bin\fabric\fabric.code" "ServiceFabricServiceModel.xsd"
2017-06-06T16:01:00.9146136Z ##[debug]C:\Program Files\Microsoft Service Fabric\bin\fabric\fabric.code\ServiceFabricServiceModel.xsd
2017-06-06T16:01:00.9156210Z ##[debug]Length: 94
2017-06-06T16:01:00.9166135Z ##[debug]
2017-06-06T16:01:00.9186137Z ##[debug]Test-Path "C:\Program Files\Microsoft Service Fabric\bin\fabric\fabric.code\ServiceFabricServiceModel.xsd"
2017-06-06T16:01:00.9216373Z ##[debug]True
2017-06-06T16:01:00.9226141Z ##[debug]
2017-06-06T16:01:03.5668693Z ##[debug]Leaving D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.3.9\deploy.ps1.
2017-06-06T16:01:03.5767636Z ##[debug]Caught exception from task script.
2017-06-06T16:01:03.5787644Z ##[debug]Error record:
2017-06-06T16:01:03.6307491Z ##[debug]Application type of application '' doesn't match the application type in the application manifest of the new application package. Please ensure that the application being upgraded has the same application type.
2017-06-06T16:01:03.6317836Z ##[debug]At D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.3.9\ServiceFabricSDK\Publish-UpgradedServiceFabricApplication.ps1:195 char:17
2017-06-06T16:01:03.6329753Z ##[debug]+ throw $errMsg
2017-06-06T16:01:03.6338786Z ##[debug]+ ~~~~~~~~~~~~~
2017-06-06T16:01:03.6350377Z ##[debug] + CategoryInfo : OperationStopped: (Application typ...plication type.:String) [], RuntimeException
2017-06-06T16:01:03.6360412Z ##[debug] + FullyQualifiedErrorId : Application type of application '' doesn't match the application type in the application manifest of the new application package. Please ensure that the application being upgraded has the same applicati on type.
2017-06-06T16:01:03.6370408Z ##[debug]
2017-06-06T16:01:03.6380417Z ##[debug]Script stack trace:
2017-06-06T16:01:03.6410418Z ##[debug]at Publish-UpgradedServiceFabricApplication, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.3.9\ServiceFabricSDK\Publish-UpgradedServiceFabricApplication.ps1: line 195
2017-06-06T16:01:03.6420417Z ##[debug]at <ScriptBlock>, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.3.9\deploy.ps1: line 144
2017-06-06T16:01:03.6430417Z ##[debug]at <ScriptBlock>, <No file>: line 1
2017-06-06T16:01:03.6440419Z ##[debug]at <ScriptBlock>, <No file>: line 22
2017-06-06T16:01:03.6450418Z ##[debug]at <ScriptBlock>, <No file>: line 18
2017-06-06T16:01:03.6460418Z ##[debug]at <ScriptBlock>, <No file>: line 1
2017-06-06T16:01:03.6480463Z ##[debug]Exception:
2017-06-06T16:01:03.6529321Z ##[debug]System.Management.Automation.RuntimeException: Application type of application '' doesn't match the application type in the application manifest of the new application package. Please ensure that the application being upgraded has the same application type.
2017-06-06T16:01:03.6825375Z ##[error]Application type of application '' doesn't match the application type in the application manifest of the new application package. Please ensure that the application being upgraded has the same application type.
2017-06-06T16:01:03.6825375Z ##[debug]Processed: ##vso[task.logissue type=error]Application type of application '' doesn't match the application type in the application manifest of the new application package. Please ensure that the application being upgraded has the same application type.
2017-06-06T16:01:03.6845374Z ##[debug]Processed: ##vso[task.complete result=Failed]
2017-06-06T16:01:03.7105387Z ##[section]Finishing: Deploy Service Fabric Application
2017-06-06T16:01:03.7155386Z ##[debug]Cleaning agent temp folder: d:\a\_temp
2017-06-06T16:01:03.7155386Z ##[section]Finishing: Release
I found the root cause and it's so silly. It's really easy to missed this as you can't see the whole textbox values in vsts unless you drag your mouse up to the end. The parameters is also pointing to publish profiles which is wrong and I corrected that.

Error deploying Service Fabric application - Cannot index into a null array

I have configured a deployment to a Service Fabric application using Visual Studio Team Services (hosted agent). Everything was working as expected until very recently. Now deployments are failing with the following error message:
Cannot index into a null array.
Task is configured as follows:
This is the full log of the deployment task:
2017-02-13T13:23:25.4033826Z ##[section]Starting: Deploy Service Fabric Application
2017-02-13T13:23:25.4113825Z ==============================================================================
2017-02-13T13:23:25.4113825Z Task : Service Fabric Application Deployment
2017-02-13T13:23:25.4113825Z Description : Deploy a Service Fabric application to a cluster.
2017-02-13T13:23:25.4113825Z Version : 1.3.3
2017-02-13T13:23:25.4113825Z Author : Microsoft Corporation
2017-02-13T13:23:25.4113825Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=820528)
2017-02-13T13:23:25.4123824Z ==============================================================================
2017-02-13T13:23:28.3707902Z ##[debug]VstsTaskSdk 0.7.1 commit f990f8d8df6197b1cfcec01031ba014ad4905681
2017-02-13T13:23:28.7247919Z ##[debug]Entering D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.3.3\deploy.ps1.
2017-02-13T13:23:28.7397904Z ##[debug]Loading resource strings from: D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.3.3\task.json
2017-02-13T13:23:28.8877911Z ##[debug]Loaded 49 strings.
2017-02-13T13:23:28.8977907Z ##[debug]SYSTEM_CULTURE: 'en-US'
2017-02-13T13:23:28.8987909Z ##[debug]Loading resource strings from: D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.3.3\Strings\resources.resjson\en-US\resources.resjson
2017-02-13T13:23:29.0617895Z ##[debug]Loaded 49 strings.
2017-02-13T13:23:29.1177896Z ##[debug]INPUT_PUBLISHPROFILEPATH: 'D:\a\r1\a\artifacts\ServiceFabric\Config\PublishProfiles\Cloud.qa.xml'
2017-02-13T13:23:29.1805007Z Searching for path: D:\a\r1\a\artifacts\ServiceFabric\Config\PublishProfiles\Cloud.qa.xml
2017-02-13T13:23:29.2145006Z ##[debug]Entering Find-VstsFiles.
2017-02-13T13:23:29.2305008Z ##[debug] LegacyPattern: 'D:\a\r1\a\artifacts\ServiceFabric\Config\PublishProfiles\Cloud.qa.xml'
2017-02-13T13:23:29.2895008Z ##[debug]Entering Get-MatchingItems.
2017-02-13T13:23:29.2944996Z ##[debug] IncludePatterns: 'D:\a\r1\a\artifacts\ServiceFabric\Config\PublishProfiles\Cloud.qa.xml'
2017-02-13T13:23:29.3034992Z ##[debug] ExcludePatterns: ''
2017-02-13T13:23:29.3104997Z ##[debug] IncludeFiles: 'True'
2017-02-13T13:23:29.3135007Z ##[debug] IncludeDirectories: 'False'
2017-02-13T13:23:29.3405018Z ##[debug] Force: 'False'
2017-02-13T13:23:29.5979986Z ##[debug]Path: D:\a\r1\a\artifacts\ServiceFabric\Config\PublishProfiles\Cloud.qa.xml
2017-02-13T13:23:29.6040007Z ##[debug]Leaving Get-MatchingItems.
2017-02-13T13:23:29.6079982Z ##[debug]Total found: 1
2017-02-13T13:23:29.6109978Z ##[debug]Leaving Find-VstsFiles.
2017-02-13T13:23:29.6329988Z ##[debug]Asserting leaf path exists: 'D:\a\r1\a\artifacts\ServiceFabric\Config\PublishProfiles\Cloud.qa.xml'
2017-02-13T13:23:29.6350041Z Found path: D:\a\r1\a\artifacts\ServiceFabric\Config\PublishProfiles\Cloud.qa.xml
2017-02-13T13:23:29.7000090Z ##[debug]INPUT_APPLICATIONPACKAGEPATH: 'D:\a\r1\a\publish\Release'
2017-02-13T13:23:29.7010019Z Searching for path: D:\a\r1\a\publish\Release
2017-02-13T13:23:29.7049996Z ##[debug]Entering Find-VstsFiles.
2017-02-13T13:23:29.7079987Z ##[debug] LegacyPattern: 'D:\a\r1\a\publish\Release'
2017-02-13T13:23:29.7100038Z ##[debug] IncludeDirectories: 'True'
2017-02-13T13:23:29.7140043Z ##[debug]Entering Get-MatchingItems.
2017-02-13T13:23:29.7169997Z ##[debug] IncludePatterns: 'D:\a\r1\a\publish\Release'
2017-02-13T13:23:29.7200023Z ##[debug] ExcludePatterns: ''
2017-02-13T13:23:29.7230026Z ##[debug] IncludeFiles: 'False'
2017-02-13T13:23:29.7250041Z ##[debug] IncludeDirectories: 'True'
2017-02-13T13:23:29.7720050Z ##[debug] Force: 'False'
2017-02-13T13:23:29.9969997Z ##[debug]Path: D:\a\r1\a\publish\Release
2017-02-13T13:23:29.9969997Z ##[debug]Leaving Get-MatchingItems.
2017-02-13T13:23:29.9969997Z ##[debug]Total found: 1
2017-02-13T13:23:29.9969997Z ##[debug]Leaving Find-VstsFiles.
2017-02-13T13:23:29.9969997Z ##[debug]Asserting container path exists: 'D:\a\r1\a\publish\Release'
2017-02-13T13:23:29.9969997Z Found path: D:\a\r1\a\publish\Release
2017-02-13T13:23:29.9979996Z ##[debug]INPUT_SERVICECONNECTIONNAME: '307f16ba-c7b0-44be-9998-050e6075a9b6'
2017-02-13T13:23:29.9979996Z ##[debug]ENDPOINT_URL_307f16ba-c7b0-44be-9998-050e6075a9b6: 'https://xxxxxxxxxxxx.cloudapp.azure.com:19000/'
2017-02-13T13:23:29.9979996Z ##[debug]ENDPOINT_AUTH_xxxxxxxxxxxx: '********'
2017-02-13T13:23:30.0010004Z ##[debug]ENDPOINT_DATA_xxxxxxxxxxxx: '{}'
2017-02-13T13:23:30.0079998Z ##[debug]INPUT_COPYPACKAGETIMEOUTSEC (empty)
2017-02-13T13:23:30.0169999Z ##[debug]INPUT_REGISTERPACKAGETIMEOUTSEC (empty)
2017-02-13T13:23:30.0209986Z ##[debug]INPUT_COMPRESSPACKAGE: 'true'
2017-02-13T13:23:30.1139975Z ##[warning]Your deploy task has been upgraded to a new version with possible breaking changes. The Cluster Endpoint defined in your service endpoint was previously ignored, but will now override the value in the publish profile. Verify the endpoint is correct and prefixed with 'https://'. In addition, a Server Certificate Thumbprint field has been added to the service endpoint and will also override the publish profile value. Your service endpoint may not have been updated to allow specifying the Server Certificate Thumbprint, in which case we will still use the value from the publish profile and you should try again soon.
2017-02-13T13:23:30.1139975Z ##[debug]Processed: ##vso[task.logissue type=warning]Your deploy task has been upgraded to a new version with possible breaking changes. The Cluster Endpoint defined in your service endpoint was previously ignored, but will now override the value in the publish profile. Verify the endpoint is correct and prefixed with 'https://'. In addition, a Server Certificate Thumbprint field has been added to the service endpoint and will also override the publish profile value. Your service endpoint may not have been updated to allow specifying the Server Certificate Thumbprint, in which case we will still use the value from the publish profile and you should try again soon.
2017-02-13T13:23:30.2456671Z ##[debug]Leaving D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.3.3\deploy.ps1.
2017-02-13T13:23:30.2646567Z ##[debug]Caught exception from task script.
2017-02-13T13:23:30.2696555Z ##[debug]Error record:
2017-02-13T13:23:30.3756887Z ##[debug]D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.3.3\deploy.ps1 : Cannot index into a null array.
2017-02-13T13:23:30.3766890Z ##[debug]At line:1 char:1
2017-02-13T13:23:30.3786885Z ##[debug]+ . 'D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c ...
2017-02-13T13:23:30.3806878Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2017-02-13T13:23:30.3816887Z ##[debug] + CategoryInfo : InvalidOperation: (:) [deploy.ps1], RuntimeException
2017-02-13T13:23:30.3836876Z ##[debug] + FullyQualifiedErrorId : NullArray,deploy.ps1
2017-02-13T13:23:30.3846887Z ##[debug]
2017-02-13T13:23:30.3876887Z ##[debug]Script stack trace:
2017-02-13T13:23:30.3926870Z ##[debug]at <ScriptBlock>, D:\a\_tasks\ServiceFabricDeploy_c6650aa0-185b-11e6-a47d-df93e7a34c64\1.3.3\deploy.ps1: line 57
2017-02-13T13:23:30.3946887Z ##[debug]at <ScriptBlock>, <No file>: line 1
2017-02-13T13:23:30.3966873Z ##[debug]at <ScriptBlock>, <No file>: line 22
2017-02-13T13:23:30.3976888Z ##[debug]at <ScriptBlock>, <No file>: line 18
2017-02-13T13:23:30.3996872Z ##[debug]at <ScriptBlock>, <No file>: line 1
2017-02-13T13:23:30.4026873Z ##[debug]Exception:
2017-02-13T13:23:30.4166884Z ##[debug]System.Management.Automation.RuntimeException: Cannot index into a null array.
2017-02-13T13:23:30.4186886Z ##[debug] at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
2017-02-13T13:23:30.4206873Z ##[debug] at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
2017-02-13T13:23:30.4216885Z ##[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2017-02-13T13:23:30.4236885Z ##[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2017-02-13T13:23:30.4256882Z ##[debug] at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
2017-02-13T13:23:30.4266885Z ##[debug] at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
2017-02-13T13:23:30.4286885Z ##[debug] at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
2017-02-13T13:23:30.4306872Z ##[debug] at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
2017-02-13T13:23:30.4316888Z ##[debug] at System.Management.Automation.CommandProcessorBase.Complete()
2017-02-13T13:23:30.4639786Z ##[error]Cannot index into a null array.
2017-02-13T13:23:30.4639786Z ##[debug]Processed: ##vso[task.logissue type=error]Cannot index into a null array.
2017-02-13T13:23:30.4666547Z ##[debug]Processed: ##vso[task.complete result=Failed]
2017-02-13T13:23:30.4886539Z ##[section]Finishing: Deploy Service Fabric Application
BTW I've noticed that the hosted agents were updated recently (2/7/2017), I'm wondering if that could be related to this issue?
Not sure what happened but I was able to fix the problem.
I have deleted the Azure Service Fabric endpoint and created a new one (Certificate Based), with the correct Thumbprint, Client Certificate, Password etc.

Resources