Using VS2019 with TFS2018 vnext build system - azure-pipelines-build-task

Does anybody know if it is possible to use VS2019 with TFS2018 vnext build system.
You cannot select VS2019 in the build definition, but you can select "Latest" as version for Visual Studio.
Unfortunately, this does not select VS2019.
I have tested this in a virtual machine with VS2017 and VS2019 installed.
I also upgraded TFS2018 to Azure DevOps Server 2019, which solved the problem.
But this is not a "quick" solution for our production environment.
Here are the logs from my tests. As you can see, selecting "Latest" as version for Visual Studio ended in and error, that no VS was selected at all:
TFS2018 / VS2017:
2019-04-05T07:38:58.8044647Z ##[debug]Entering Select-VSVersion.
2019-04-05T07:38:58.8080670Z ##[debug] PreferredVersion: '15.0'
2019-04-05T07:38:58.8363094Z ##[debug]Entering Get-VSPath.
2019-04-05T07:38:58.8393121Z ##[debug] Version: '15.0'
2019-04-05T07:38:58.8464182Z ##[debug]Entering Get-VisualStudio_15_0.
2019-04-05T07:38:58.8516552Z ##[debug]Getting latest Visual Studio 15 setup instance.
2019-04-05T07:38:58.8727275Z ##[debug]Entering Invoke-VstsTool.
2019-04-05T07:38:58.8759258Z ##[debug] FileName: 'C:\b\a1\_w\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.126.0\ps_modules\MSBuildHelpers\vswhere.exe'
2019-04-05T07:38:58.8790622Z ##[debug] Arguments: '-version [15.0,16.0) -latest -format json'
2019-04-05T07:38:58.8861580Z ##[debug] RequireExitCodeZero: 'True'
2019-04-05T07:38:58.8899897Z ##[command]"C:\b\a1\_w\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.126.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -latest -format json
2019-04-05T07:38:58.9699602Z ##[debug][
2019-04-05T07:38:58.9775093Z ##[debug] {
2019-04-05T07:38:58.9805669Z ##[debug] "instanceId": "716a72e1",
2019-04-05T07:38:58.9836484Z ##[debug] "installDate": "2018-06-19T06:36:30Z",
2019-04-05T07:38:58.9866720Z ##[debug] "installationName": "VisualStudio/15.9.11+28307.586",
2019-04-05T07:38:58.9896856Z ##[debug] "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise",
2019-04-05T07:38:58.9925760Z ##[debug] "installationVersion": "15.9.28307.586",
2019-04-05T07:38:58.9955813Z ##[debug] "displayName": "Visual Studio Enterprise 2017",
2019-04-05T07:38:58.9984855Z ##[debug] "description": "Microsoft DevOps solution for productivity and coordination across teams of any size",
2019-04-05T07:38:59.0016503Z ##[debug] "updateDate": "2019-04-05T05:41:52.3762392Z",
2019-04-05T07:38:59.0046346Z ##[debug] "enginePath": "C:\\program files (x86)\\microsoft visual studio\\installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
2019-04-05T07:38:59.0076156Z ##[debug] "channelId": "VisualStudio.15.Release",
2019-04-05T07:38:59.0105757Z ##[debug] "channelUri": "https://aka.ms/vs/15/release/channel",
2019-04-05T07:38:59.0141128Z ##[debug] "releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660692#15.9.11",
2019-04-05T07:38:59.0174229Z ##[debug] "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660708"
2019-04-05T07:38:59.0212954Z ##[debug] }
2019-04-05T07:38:59.0246814Z ##[debug]]
2019-04-05T07:38:59.0278717Z ##[debug]Exit code: 0
2019-04-05T07:38:59.0330925Z ##[debug]Leaving Invoke-VstsTool.
2019-04-05T07:38:59.0514424Z ##[debug]Leaving Get-VisualStudio_15_0.
2019-04-05T07:38:59.0572938Z ##[debug]Leaving Get-VSPath.
2019-04-05T07:38:59.0606126Z ##[debug]Leaving Select-VSVersion.
TFS2018 / VS Latest:
2019-04-09T05:41:00.8981538Z ##[debug]Entering Select-VSVersion.
2019-04-09T05:41:00.9013462Z ##[debug] PreferredVersion: 'latest'
2019-04-09T05:41:00.9716480Z ##[debug]Entering Get-VSPath.
2019-04-09T05:41:00.9752054Z ##[debug] Version: '15.0'
2019-04-09T05:41:00.9837070Z ##[debug]Entering Get-VisualStudio_15_0.
2019-04-09T05:41:00.9894721Z ##[debug]Getting latest Visual Studio 15 setup instance.
2019-04-09T05:41:01.0055503Z ##[debug]Entering Invoke-VstsTool.
2019-04-09T05:41:01.0093274Z ##[debug] FileName: 'C:\b\a1\_w\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.126.0\ps_modules\MSBuildHelpers\vswhere.exe'
2019-04-09T05:41:01.0130764Z ##[debug] Arguments: '-version [15.0,16.0) -latest -format json'
2019-04-09T05:41:01.0223884Z ##[debug] RequireExitCodeZero: 'True'
2019-04-09T05:41:01.0351851Z ##[command]"C:\b\a1\_w\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.126.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -latest -format json
2019-04-09T05:41:01.1433479Z ##[debug][]
2019-04-09T05:41:01.1662464Z ##[debug]Exit code: 0
2019-04-09T05:41:01.1723129Z ##[debug]Leaving Invoke-VstsTool.
2019-04-09T05:41:01.1837285Z ##[debug]Getting latest BuildTools 15 setup instance.
2019-04-09T05:41:01.1876304Z ##[debug]Entering Invoke-VstsTool.
2019-04-09T05:41:01.1908643Z ##[debug] FileName: 'C:\b\a1\_w\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.126.0\ps_modules\MSBuildHelpers\vswhere.exe'
2019-04-09T05:41:01.1940815Z ##[debug] Arguments: '-version [15.0,16.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json'
2019-04-09T05:41:01.1976900Z ##[debug] RequireExitCodeZero: 'True'
2019-04-09T05:41:01.1995329Z ##[command]"C:\b\a1\_w\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.126.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
2019-04-09T05:41:01.2651914Z ##[debug][]
2019-04-09T05:41:01.2684020Z ##[debug]Exit code: 0
2019-04-09T05:41:01.2722901Z ##[debug]Leaving Invoke-VstsTool.
2019-04-09T05:41:01.2761049Z ##[debug]Leaving Get-VisualStudio_15_0.
2019-04-09T05:41:01.2878667Z ##[debug]Leaving Get-VSPath.
2019-04-09T05:41:01.2918773Z ##[debug]Entering Get-VSPath.
2019-04-09T05:41:01.2951134Z ##[debug] Version: '14.0'
2019-04-09T05:41:01.3025150Z ##[debug]Leaving Get-VSPath.
2019-04-09T05:41:01.3060830Z ##[debug]Entering Get-VSPath.
2019-04-09T05:41:01.3091486Z ##[debug] Version: '12.0'
2019-04-09T05:41:01.3161729Z ##[debug]Leaving Get-VSPath.
2019-04-09T05:41:01.3203687Z ##[debug]Entering Get-VSPath.
2019-04-09T05:41:01.3241272Z ##[debug] Version: '11.0'
2019-04-09T05:41:01.3668002Z ##[debug]Leaving Get-VSPath.
2019-04-09T05:41:01.3705810Z ##[debug]Entering Get-VSPath.
2019-04-09T05:41:01.3735775Z ##[debug] Version: '10.0'
2019-04-09T05:41:01.4070765Z ##[debug]Leaving Get-VSPath.
2019-04-09T05:41:01.4578925Z ##[warning]Visual Studio was not found. Try installing a supported version of Visual Studio. See the task definition for a list of supported versions.
2019-04-09T05:41:01.4594500Z ##[debug]Processed: ##vso[task.logissue type=warning]Visual Studio was not found. Try installing a supported version of Visual Studio. See the task definition for a list of supported versions.
2019-04-09T05:41:01.4595403Z ##[debug]Leaving Select-VSVersion.
Azure DevOps Server 2019 / VS2017:
2019-04-08T08:51:31.5394326Z ##[debug]Entering Select-VSVersion.
2019-04-08T08:51:31.5427853Z ##[debug] PreferredVersion: '15.0'
2019-04-08T08:51:31.8561977Z ##[debug]Entering Get-VSPath.
2019-04-08T08:51:31.8599268Z ##[debug] Version: '15.0'
2019-04-08T08:51:31.8719549Z ##[debug]Entering Get-VisualStudio.
2019-04-08T08:51:31.8759349Z ##[debug] MajorVersion: '15'
2019-04-08T08:51:31.8817839Z ##[debug]Getting latest Visual Studio 15 setup instance.
2019-04-08T08:51:31.9024842Z ##[debug]Entering Invoke-VstsTool.
2019-04-08T08:51:31.9064288Z ##[debug] FileName: 'C:\b\a1\_w\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.146.0\ps_modules\MSBuildHelpers\vswhere.exe'
2019-04-08T08:51:31.9098181Z ##[debug] Arguments: '-version [15.0,16.0) -latest -format json'
2019-04-08T08:51:31.9176808Z ##[debug] RequireExitCodeZero: 'True'
2019-04-08T08:51:31.9284024Z ##[command]"C:\b\a1\_w\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.146.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -latest -format json
2019-04-08T08:51:32.3297138Z ##[debug][
2019-04-08T08:51:32.3374619Z ##[debug] {
2019-04-08T08:51:32.3405784Z ##[debug] "instanceId": "716a72e1",
2019-04-08T08:51:32.3443076Z ##[debug] "installDate": "2018-06-19T06:36:30Z",
2019-04-08T08:51:32.3475952Z ##[debug] "installationName": "VisualStudio/15.9.11+28307.586",
2019-04-08T08:51:32.3508932Z ##[debug] "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise",
2019-04-08T08:51:32.3543169Z ##[debug] "installationVersion": "15.9.28307.586",
2019-04-08T08:51:32.3574381Z ##[debug] "displayName": "Visual Studio Enterprise 2017",
2019-04-08T08:51:32.3605500Z ##[debug] "description": "Microsoft DevOps solution for productivity and coordination across teams of any size",
2019-04-08T08:51:32.3635154Z ##[debug] "updateDate": "2019-04-05T05:41:52.3762392Z",
2019-04-08T08:51:32.3665443Z ##[debug] "enginePath": "C:\\program files (x86)\\microsoft visual studio\\installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
2019-04-08T08:51:32.3694997Z ##[debug] "channelId": "VisualStudio.15.Release",
2019-04-08T08:51:32.3723832Z ##[debug] "channelUri": "https://aka.ms/vs/15/release/channel",
2019-04-08T08:51:32.3757656Z ##[debug] "releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660692#15.9.11",
2019-04-08T08:51:32.3787461Z ##[debug] "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660708"
2019-04-08T08:51:32.3816345Z ##[debug] }
2019-04-08T08:51:32.3851914Z ##[debug]]
2019-04-08T08:51:32.3883080Z ##[debug]Exit code: 0
2019-04-08T08:51:32.3940945Z ##[debug]Leaving Invoke-VstsTool.
2019-04-08T08:51:32.4207172Z ##[debug]Leaving Get-VisualStudio.
2019-04-08T08:51:32.4269153Z ##[debug]Leaving Get-VSPath.
2019-04-08T08:51:32.4306347Z ##[debug]Leaving Select-VSVersion.
Azure DevOps Server 2019 / VS2019:
2019-04-08T13:11:16.3262140Z ##[debug]Entering Select-VSVersion.
2019-04-08T13:11:16.3316185Z ##[debug] PreferredVersion: '16.0'
2019-04-08T13:11:16.5683152Z ##[debug]Entering Get-VSPath.
2019-04-08T13:11:16.5713957Z ##[debug] Version: '16.0'
2019-04-08T13:11:16.5830477Z ##[debug]Entering Get-VisualStudio.
2019-04-08T13:11:16.5867812Z ##[debug] MajorVersion: '16'
2019-04-08T13:11:16.5936312Z ##[debug]Getting latest Visual Studio 16 setup instance.
2019-04-08T13:11:16.6207158Z ##[debug]Entering Invoke-VstsTool.
2019-04-08T13:11:16.6236159Z ##[debug] FileName: 'C:\b\a1\_w\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.146.0\ps_modules\MSBuildHelpers\vswhere.exe'
2019-04-08T13:11:16.6264679Z ##[debug] Arguments: '-version [16.0,17.0) -latest -format json'
2019-04-08T13:11:16.6346113Z ##[debug] RequireExitCodeZero: 'True'
2019-04-08T13:11:16.6390903Z ##[command]"C:\b\a1\_w\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.146.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
2019-04-08T13:11:16.9463375Z ##[debug][
2019-04-08T13:11:16.9549197Z ##[debug] {
2019-04-08T13:11:16.9586965Z ##[debug] "instanceId": "1e8be92e",
2019-04-08T13:11:16.9633525Z ##[debug] "installDate": "2019-04-05T04:43:03Z",
2019-04-08T13:11:16.9673957Z ##[debug] "installationName": "VisualStudio/16.0.0+28729.10",
2019-04-08T13:11:16.9708765Z ##[debug] "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise",
2019-04-08T13:11:16.9740525Z ##[debug] "installationVersion": "16.0.28729.10",
2019-04-08T13:11:16.9771033Z ##[debug] "displayName": "Visual Studio Enterprise 2019",
2019-04-08T13:11:16.9806117Z ##[debug] "description": "Microsoft DevOps solution for productivity and coordination across teams of any size",
2019-04-08T13:11:16.9847474Z ##[debug] "updateDate": "2019-04-05T04:43:03.9231866Z",
2019-04-08T13:11:16.9890390Z ##[debug] "enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
2019-04-08T13:11:16.9930603Z ##[debug] "layoutPath": "E:\\",
2019-04-08T13:11:16.9974686Z ##[debug] "channelId": "VisualStudio.16.Release",
2019-04-08T13:11:17.0007956Z ##[debug] "channelUri": "https://aka.ms/vs/16/release/channel",
2019-04-08T13:11:17.0046086Z ##[debug] "installChannelUri": "E:\\ChannelManifest.json",
2019-04-08T13:11:17.0084654Z ##[debug] "releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660893#16.0.0",
2019-04-08T13:11:17.0129982Z ##[debug] "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660909"
2019-04-08T13:11:17.0171988Z ##[debug] }
2019-04-08T13:11:17.0211123Z ##[debug]]
2019-04-08T13:11:17.0251034Z ##[debug]Exit code: 0
2019-04-08T13:11:17.0310329Z ##[debug]Leaving Invoke-VstsTool.
2019-04-08T13:11:17.0610458Z ##[debug]Leaving Get-VisualStudio.
2019-04-08T13:11:17.0675928Z ##[debug]Leaving Get-VSPath.
2019-04-08T13:11:17.0715177Z ##[debug]Leaving Select-VSVersion.

It's not an easy fix. The changes required were pretty extensive.
Officially, the built-in tasks are only upgraded when you upgrade the server to it's next Update version or Major version. TFS 2018 update 3.2 is the latest update version for TFS 2018 and given that Azure DevOps Server 2019 (the new name for TFS) has just been released, I expect that no new versions of the tasks will ship for TFS 2018 update 4 should it ever see the light.
Workaround
CAUTION this may cause issues when upgrading to another server version at a later stage, may require newer versions of the Azure Pipelines Agent and can put you in an unsupported state.
You can clone the Azure Pipelines Tasks repo, build it locally and then use tfx-cli to upgrade the built-in tasks in your server.
git clone https://github.com/Microsoft/azure-pipelines-tasks.git
cd azure-pipelines-tasks
npm install
npm run-script build --task MSBuildV1
npm run-script build --task VstestV2
npm run-script build --task VSBuildV1
npm install tfx-cli#latest -g
tfx build tasks upload --task-path .\MSBuildV2 --service-url {{https://server/tfs/collection}}
tfx build tasks upload --task-path .\VsTestV2 --service-url {{https://server/tfs/collection}}
tfx build tasks upload --task-path .\VsBuildV1 --service-url {{https://server/tfs/collection}}
Repeat for every Project Collection on your server.

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 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.

VSTS Azure App Service Deploy release task doesn't update files

In my release definition, I have a step to deploy Azure web app service.
The step is finished without any errors, however, the application files inside the wwroot folder aren't changed.
Below are the logs for this step:
2018-06-04T11:33:58.6519687Z ##[debug]Evaluating condition for step: 'Deploy Azure App Service'
2018-06-04T11:33:58.6520505Z ##[debug]Evaluating: succeeded()
2018-06-04T11:33:58.6521823Z ##[debug]Evaluating succeeded:
2018-06-04T11:33:58.6522364Z ##[debug]=> True
2018-06-04T11:33:58.6522960Z ##[debug]Result: True
2018-06-04T11:33:58.6523283Z ##[section]Starting: Deploy Azure App Service
2018-06-04T11:33:58.6532729Z ==============================================================================
2018-06-04T11:33:58.6532941Z Task : Azure App Service Deploy
2018-06-04T11:33:58.6533434Z Description : Update Azure WebApp Services On Windows, Web App On Linux with built-in images or docker containers, ASP.NET, .NET Core, PHP, Python or Node based Web applications, Function Apps, Mobile Apps, Api applications, Web Jobs using Web Deploy / Kudu REST APIs
2018-06-04T11:33:58.6533758Z Version : 3.3.47
2018-06-04T11:33:58.6533900Z Author : Microsoft Corporation
2018-06-04T11:33:58.6534147Z Help : [More Information](https://aka.ms/azurermwebdeployreadme)
2018-06-04T11:33:58.6534361Z ==============================================================================
2018-06-04T11:33:59.3700194Z ##[debug]agent.workFolder=D:\a
2018-06-04T11:33:59.3728077Z ##[debug]loading inputs and endpoints
2018-06-04T11:33:59.3733912Z ##[debug]loading ENDPOINT_AUTH_82e35813-117a-4528-8bdc-11c81d0ff34f
2018-06-04T11:33:59.3743052Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_82e35813-117a-4528-8bdc-11c81d0ff34f_SERVICEPRINCIPALID
2018-06-04T11:33:59.3744991Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_82e35813-117a-4528-8bdc-11c81d0ff34f_SERVICEPRINCIPALKEY
2018-06-04T11:33:59.3747384Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_82e35813-117a-4528-8bdc-11c81d0ff34f_TENANTID
2018-06-04T11:33:59.3748988Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2018-06-04T11:33:59.3752177Z ##[debug]loading ENDPOINT_AUTH_SCHEME_82e35813-117a-4528-8bdc-11c81d0ff34f
2018-06-04T11:33:59.3753927Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2018-06-04T11:33:59.3762167Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2018-06-04T11:33:59.3764454Z ##[debug]loading INPUT_BUILTINLINUXPACKAGE
2018-06-04T11:33:59.3766013Z ##[debug]loading INPUT_CONNECTEDSERVICENAME
2018-06-04T11:33:59.3769223Z ##[debug]loading INPUT_DEPLOYTOSLOTFLAG
2018-06-04T11:33:59.3770780Z ##[debug]loading INPUT_DOCKERIMAGETAG
2018-06-04T11:33:59.3772243Z ##[debug]loading INPUT_DOCKERREPOSITORYACCESS
2018-06-04T11:33:59.3773874Z ##[debug]loading INPUT_EXCLUDEFILESFROMAPPDATAFLAG
2018-06-04T11:33:59.3776019Z ##[debug]loading INPUT_GENERATEWEBCONFIG
2018-06-04T11:33:59.3778404Z ##[debug]loading INPUT_IMAGESOURCE
2018-06-04T11:33:59.3782399Z ##[debug]loading INPUT_PACKAGE
2018-06-04T11:33:59.3785149Z ##[debug]loading INPUT_REMOVEADDITIONALFILESFLAG
2018-06-04T11:33:59.3787205Z ##[debug]loading INPUT_RENAMEFILESFLAG
2018-06-04T11:33:59.3788675Z ##[debug]loading INPUT_SCRIPTPATH
2018-06-04T11:33:59.3792890Z ##[debug]loading INPUT_SETPARAMETERSFILE
2018-06-04T11:33:59.3794770Z ##[debug]loading INPUT_TAKEAPPOFFLINEFLAG
2018-06-04T11:33:59.3796033Z ##[debug]loading INPUT_USEWEBDEPLOY
2018-06-04T11:33:59.3797768Z ##[debug]loading INPUT_WEBAPPKIND
2018-06-04T11:33:59.3799792Z ##[debug]loading INPUT_WEBAPPNAME
2018-06-04T11:33:59.3801422Z ##[debug]loading INPUT_XMLTRANSFORMATION
2018-06-04T11:33:59.3802688Z ##[debug]loading INPUT_XMLVARIABLESUBSTITUTION
2018-06-04T11:33:59.3813905Z ##[debug]loaded 27
2018-06-04T11:33:59.4137921Z ##[debug]agent.proxyurl=undefined
2018-06-04T11:33:59.4139193Z ##[debug]VSTS_ARM_REST_IGNORE_SSL_ERRORS=undefined
2018-06-04T11:33:59.4139704Z ##[debug]AZURE_HTTP_USER_AGENT=VSTS_e9a6b698-6440-443e-a398-c358fe7b1c29_release_4_304_2030_1
2018-06-04T11:33:59.6358043Z ##[debug]check path : D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.3.47\task.json
2018-06-04T11:33:59.6361018Z ##[debug]set resource file to: D:\a\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.3.47\task.json
2018-06-04T11:33:59.6362477Z ##[debug]system.culture=en-US
2018-06-04T11:33:59.6498166Z ##[debug]ConnectedServiceName=82e35813-117a-4528-8bdc-11c81d0ff34f
2018-06-04T11:33:59.6501539Z ##[debug]WebAppName=XXXXXAPP
2018-06-04T11:33:59.6502672Z ##[debug]WebAppKind=app
2018-06-04T11:33:59.6504365Z ##[debug]DeployToSlotFlag=false
2018-06-04T11:33:59.6505866Z ##[debug]VirtualApplication=null
2018-06-04T11:33:59.6508534Z ##[debug]Package=D:\a\r1\a\XXXXX_Build\XXXXX\XXXXX.zip
2018-06-04T11:33:59.6510245Z ##[debug]GenerateWebConfig=false
2018-06-04T11:33:59.6510679Z ##[debug]WebConfigParameters=null
2018-06-04T11:33:59.6512305Z ##[debug]XmlTransformation=false
2018-06-04T11:33:59.6513464Z ##[debug]JSONFiles=null
2018-06-04T11:33:59.6514797Z ##[debug]XmlVariableSubstitution=false
2018-06-04T11:33:59.6516893Z ##[debug]UseWebDeploy=true
2018-06-04T11:33:59.6518387Z ##[debug]TakeAppOfflineFlag=false
2018-06-04T11:33:59.6519647Z ##[debug]RenameFilesFlag=true
2018-06-04T11:33:59.6520311Z ##[debug]AdditionalArguments=null
2018-06-04T11:33:59.6520595Z ##[debug]ScriptType=null
2018-06-04T11:33:59.6520882Z ##[debug]InlineScript=null
2018-06-04T11:33:59.6521833Z ##[debug]ScriptPath=D:\a\r1\a
2018-06-04T11:33:59.6522120Z ##[debug]DockerNamespace=null
2018-06-04T11:33:59.6522450Z ##[debug]AppSettings=null
2018-06-04T11:33:59.6524040Z ##[debug]ImageSource=Registry
2018-06-04T11:33:59.6524356Z ##[debug]StartupCommand=null
2018-06-04T11:33:59.6524701Z ##[debug]WebAppUri=null
2018-06-04T11:33:59.6524980Z ##[debug]ConfigurationSettings=null
2018-06-04T11:33:59.6527601Z ##[debug]RemoveAdditionalFilesFlag=false
2018-06-04T11:33:59.6535376Z ##[debug]SetParametersFile=D:\a\r1\a\XXXXX_Build\XXXXX\XXXXX.SetParameters.xml
2018-06-04T11:33:59.6541101Z ##[debug]ExcludeFilesFromAppDataFlag=false
2018-06-04T11:33:59.6541333Z ##[debug]AdditionalArguments=null
2018-06-04T11:33:59.6550903Z ##[debug]82e35813-117a-4528-8bdc-11c81d0ff34f data subscriptionid = GUID
2018-06-04T11:33:59.6551349Z ##[debug]82e35813-117a-4528-8bdc-11c81d0ff34f data subscriptionname = Pay-As-You-Go
2018-06-04T11:33:59.6553543Z ##[debug]82e35813-117a-4528-8bdc-11c81d0ff34f auth param serviceprincipalid = ***
2018-06-04T11:33:59.6555106Z ##[debug]82e35813-117a-4528-8bdc-11c81d0ff34f auth param serviceprincipalkey = ***
2018-06-04T11:33:59.6555509Z ##[debug]82e35813-117a-4528-8bdc-11c81d0ff34f data environmentAuthorityUrl = https://login.windows.net/
2018-06-04T11:33:59.6557905Z ##[debug]82e35813-117a-4528-8bdc-11c81d0ff34f auth param tenantid = ***
2018-06-04T11:33:59.6559149Z ##[debug]82e35813-117a-4528-8bdc-11c81d0ff34f=https://management.azure.com/
2018-06-04T11:33:59.6559716Z ##[debug]82e35813-117a-4528-8bdc-11c81d0ff34f data environment = AzureCloud
2018-06-04T11:33:59.6560423Z ##[debug]82e35813-117a-4528-8bdc-11c81d0ff34f data activeDirectoryServiceEndpointResourceId = https://management.core.windows.net/
2018-06-04T11:33:59.6596130Z Got connection details for Azure App Service:'XXXXXAPP'
2018-06-04T11:33:59.6634436Z ##[debug][POST]https://login.windows.net/***/oauth2/token/
2018-06-04T11:33:59.8009164Z ##[debug][GET]https://management.azure.com/subscriptions/GUID/resources?$filter=resourceType EQ 'Microsoft.Web/Sites' AND name EQ 'XXXXXAPP'&api-version=2016-07-01
2018-06-04T11:33:59.9987632Z ##[debug]Resource Group: XXXXXAPP_RG
2018-06-04T11:34:00.0004240Z ##[debug][POST]https://login.windows.net/***/oauth2/token/
2018-06-04T11:34:00.1632760Z ##[debug][POST]https://management.azure.com/subscriptions/GUID/resourceGroups/XXXXXAPP_RG/providers/Microsoft.Web/sites/XXXXXAPP/publishxml?api-version=2016-08-01
2018-06-04T11:34:00.6677707Z ##[debug][GET]http://XXXXXAPP.azurewebsites.net
2018-06-04T11:34:00.9414300Z ##[debug]App Service status Code: '301'. Status Message: 'Moved Permanently'
2018-06-04T11:34:00.9425111Z ##[debug][POST]https://management.azure.com/subscriptions/GUID/resourceGroups/XXXXXAPP_RG/providers/Microsoft.Web/sites/XXXXXAPP/config/publishingcredentials/list?api-version=2016-08-01
2018-06-04T11:34:01.4434508Z ##[debug]set AZURE_APP_SERVICE_KUDU_production_PASSWORD=********
2018-06-04T11:34:01.4438825Z ##[debug]Processed: ##vso[task.setvariable variable=AZURE_APP_SERVICE_KUDU_production_PASSWORD;issecret=true;]***
2018-06-04T11:34:01.4443201Z ##[debug]Finding files matching input: D:\a\r1\a\XXXXX_Build\XXXXX\XXXXX.zip
2018-06-04T11:34:01.4451380Z ##[debug]File Tranformation not enabled
2018-06-04T11:34:01.4452315Z ##[debug]Performing the deployment of webapp.
2018-06-04T11:34:01.4461073Z ##[debug][POST]https://management.azure.com/subscriptions/GUID/resourceGroups/XXXXXAPP_RG/providers/Microsoft.Web/sites/XXXXXAPP/config/appsettings/list?api-version=2016-08-01
2018-06-04T11:34:01.8391847Z ##[debug]Rename locked files is already enabled in App Service
2018-06-04T11:34:01.8847713Z ##[debug]SetParametersFile=D:\a\r1\a\XXXXX_Build\XXXXX\XXXXX.SetParameters.xml
2018-06-04T11:34:01.8850767Z ##[debug]Absolute path for pathSegments: D:\a\r1\a\XXXXX_Build\XXXXX\XXXXX.SetParameters.xml = D:\a\r1\a\XXXXX_Build\XXXXX\XXXXX.SetParameters.xml
2018-06-04T11:34:01.8851284Z ##[debug]build.sourcesDirectory=undefined
2018-06-04T11:34:01.8851635Z ##[debug]system.defaultWorkingDirectory=D:\a\r1\a
2018-06-04T11:34:01.8852006Z ##[debug]Absolute path for pathSegments: D:\a\r1\a = D:\a\r1\a
2018-06-04T11:34:01.8852331Z ##[debug]SetParametersFilepath supplied :true
2018-06-04T11:34:01.8852652Z ##[debug]System.DefaultWorkingDirectory=D:\a\r1\a
2018-06-04T11:34:01.8853824Z ##[debug]System.DefaultWorkingDirectory=D:\a\r1\a
2018-06-04T11:34:02.2282477Z ##[debug]Is the package an msdeploy package : true
2018-06-04T11:34:02.2284526Z ##[debug]AZURE_HTTP_USER_AGENT=VSTS_e9a6b698-6440-443e-a398-c358fe7b1c29_release_4_304_2030_1
2018-06-04T11:34:02.2284827Z ##[debug]Constructed msDeploy comamnd line arguments
2018-06-04T11:34:02.2285471Z ##[debug]appservice.msdeployretrycount=undefined
2018-06-04T11:34:02.2289929Z ##[debug]System.DefaultWorkingDirectory=D:\a\r1\a
2018-06-04T11:34:02.2296111Z ##[debug]the argument string is:
2018-06-04T11:34:02.2297010Z ##[debug] -verb:sync -source:package="'D:\a\r1\a\XXXXX_Build\XXXXX\XXXXX.zip'" -dest:auto,ComputerName="'https://XXXXXAPP.scm.azurewebsites.net:443/msdeploy.axd?site=XXXXXAPP'",UserName="'$XXXXXAPP'",Password="'***'",AuthType="'Basic'" -setParam:name="'IIS Web Application Name'",value="'XXXXXAPP'" -setParamFile=tempSetParameters.xml -enableRule:DoNotDeleteRule -userAgent:VSTS_e9a6b698-6440-443e-a398-c358fe7b1c29_release_4_304_2030_1
2018-06-04T11:34:02.2297695Z ##[debug]converting the argument string into an array of arguments
2018-06-04T11:34:02.2300188Z ##[debug]the array of arguments is:
2018-06-04T11:34:02.2300675Z ##[debug]arg#0: -verb:sync
2018-06-04T11:34:02.2301040Z ##[debug]arg#1: -source:package='D:\a\r1\a\XXXXX_Build\XXXXX\XXXXX.zip'
2018-06-04T11:34:02.2334815Z ##[debug]arg#2: -dest:auto,ComputerName='https://XXXXXAPP.scm.azurewebsites.net:443/msdeploy.axd?site=XXXXXAPP',UserName='$XXXXXAPP',Password='***',AuthType='Basic'
2018-06-04T11:34:02.2338746Z ##[debug]arg#3: -setParam:name='IIS Web Application Name',value='XXXXXAPP'
2018-06-04T11:34:02.2339153Z ##[debug]arg#4: -setParamFile=tempSetParameters.xml
2018-06-04T11:34:02.2339861Z ##[debug]arg#5: -enableRule:DoNotDeleteRule
2018-06-04T11:34:02.2340493Z ##[debug]arg#6: -userAgent:VSTS_e9a6b698-6440-443e-a398-c358fe7b1c29_release_4_304_2030_1
2018-06-04T11:34:02.2340789Z ##[debug]which 'msdeploy'
2018-06-04T11:34:02.2816090Z ##[debug]found: 'C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe'
2018-06-04T11:34:02.2816460Z ##[debug]which 'msdeploy'
2018-06-04T11:34:02.2818602Z ##[debug]found: 'C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe'
2018-06-04T11:34:02.2822414Z ##[debug]C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe arg: ["-verb:sync","-source:package='D:\\a\\r1\\a\\XXXXX_Build\\XXXXX\\XXXXX.zip'","-dest:auto,ComputerName='https://XXXXXAPP.scm.azurewebsites.net:443/msdeploy.axd?site=XXXXXAPP',UserName='$XXXXXAPP',Password='***',AuthType='Basic'","-setParam:name='IIS Web Application Name',value='XXXXXAPP'","-setParamFile=tempSetParameters.xml","-enableRule:DoNotDeleteRule","-userAgent:VSTS_e9a6b698-6440-443e-a398-c358fe7b1c29_release_4_304_2030_1"]
2018-06-04T11:34:02.2823546Z ##[debug]C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe arg: ["-verb:sync","-source:package='D:\\a\\r1\\a\\XXXXX_Build\\XXXXX\\XXXXX.zip'","-dest:auto,ComputerName='https://XXXXXAPP.scm.azurewebsites.net:443/msdeploy.axd?site=XXXXXAPP',UserName='$XXXXXAPP',Password='***',AuthType='Basic'","-setParam:name='IIS Web Application Name',value='XXXXXAPP'","-setParamFile=tempSetParameters.xml","-enableRule:DoNotDeleteRule","-userAgent:VSTS_e9a6b698-6440-443e-a398-c358fe7b1c29_release_4_304_2030_1"]
2018-06-04T11:34:02.2828281Z ##[debug]exec tool: C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe
2018-06-04T11:34:02.2828862Z ##[debug]exec tool: C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe
2018-06-04T11:34:02.2829408Z ##[debug]arguments:
2018-06-04T11:34:02.2829692Z ##[debug]arguments:
2018-06-04T11:34:02.2829997Z ##[debug] -verb:sync
2018-06-04T11:34:02.2834934Z ##[debug] -verb:sync
2018-06-04T11:34:02.2846041Z ##[debug] -source:package='D:\a\r1\a\XXXXX_Build\XXXXX\XXXXX.zip'
2018-06-04T11:34:02.2846989Z ##[debug] -source:package='D:\a\r1\a\XXXXX_Build\XXXXX\XXXXX.zip'
2018-06-04T11:34:02.2847664Z ##[debug] -dest:auto,ComputerName='https://XXXXXAPP.scm.azurewebsites.net:443/msdeploy.axd?site=XXXXXAPP',UserName='$XXXXXAPP',Password='***',AuthType='Basic'
2018-06-04T11:34:02.2848357Z ##[debug] -dest:auto,ComputerName='https://XXXXXAPP.scm.azurewebsites.net:443/msdeploy.axd?site=XXXXXAPP',UserName='$XXXXXAPP',Password='***',AuthType='Basic'
2018-06-04T11:34:02.2848923Z ##[debug] -setParam:name='IIS Web Application Name',value='XXXXXAPP'
2018-06-04T11:34:02.2849502Z ##[debug] -setParam:name='IIS Web Application Name',value='XXXXXAPP'
2018-06-04T11:34:02.2850030Z ##[debug] -setParamFile=tempSetParameters.xml
2018-06-04T11:34:02.2850362Z ##[debug] -setParamFile=tempSetParameters.xml
2018-06-04T11:34:02.2850908Z ##[debug] -enableRule:DoNotDeleteRule
2018-06-04T11:34:02.2851263Z ##[debug] -enableRule:DoNotDeleteRule
2018-06-04T11:34:02.2851635Z ##[debug] -userAgent:VSTS_e9a6b698-6440-443e-a398-c358fe7b1c29_release_4_304_2030_1
2018-06-04T11:34:02.2852040Z ##[debug] -userAgent:VSTS_e9a6b698-6440-443e-a398-c358fe7b1c29_release_4_304_2030_1
2018-06-04T11:34:02.2872121Z [command]"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='D:\a\r1\a\XXXXX_Build\XXXXX\XXXXX.zip' -dest:auto,ComputerName='https://XXXXXAPP.scm.azurewebsites.net:443/msdeploy.axd?site=XXXXXAPP',UserName='$XXXXXAPP',Password='***',AuthType='Basic' -setParam:name='IIS Web Application Name',value='XXXXXAPP' -setParamFile=tempSetParameters.xml -enableRule:DoNotDeleteRule -userAgent:VSTS_e9a6b698-6440-443e-a398-c358fe7b1c29_release_4_304_2030_1
2018-06-04T11:34:05.0759932Z Info: Using ID '1463afeb-f397-49f5-9860-b8c3f3592a8c' for connections to the remote server.
2018-06-04T11:34:07.8631955Z Info: Adding ACLs for path (XXXXXAPP)
2018-06-04T11:34:07.8632751Z Info: Adding ACLs for path (XXXXXAPP)
2018-06-04T11:34:07.8898015Z Info: Using ID '6754ac43-0b17-4852-b068-be1040bbc09c' for connections to the remote server.
2018-06-04T11:34:08.9107837Z Info: Adding ACLs for path (XXXXXAPP)
2018-06-04T11:34:08.9108873Z Info: Adding ACLs for path (XXXXXAPP)
2018-06-04T11:34:09.0365187Z Total changes: 4 (0 added, 0 deleted, 4 updated, 0 parameters changed, 0 bytes copied)
2018-06-04T11:34:09.0987232Z ##[debug]rc:0
2018-06-04T11:34:09.0987527Z ##[debug]rc:0
2018-06-04T11:34:09.0987908Z ##[debug]success:true
2018-06-04T11:34:09.0988126Z ##[debug]success:true
2018-06-04T11:34:09.0995926Z Successfully deployed web package to App Service.
2018-06-04T11:34:09.0996686Z ##[debug]rm -rf D:\a\r1\a\tempSetParameters.xml
2018-06-04T11:34:09.0998262Z ##[debug]removing file
2018-06-04T11:34:09.1026443Z ##[debug][GET]https://management.azure.com/subscriptions/GUID/resourceGroups/XXXXXAPP_RG/providers/Microsoft.Web/sites/XXXXXAPP/config/web?api-version=2016-08-01
2018-06-04T11:34:09.8306183Z ##[debug]Skipped updating the SCM value. Value: VSTSRM
2018-06-04T11:34:09.8323287Z ##[debug][GET]https://management.azure.com/subscriptions/GUID/providers/microsoft.insights/components?$filter=InstrumentationKey eq 'bbf98e17-8af5-495d-a013-9e14966f8b24'&api-version=2015-05-01
2018-06-04T11:34:10.3035682Z ##[debug]Release.ReleaseUri=vstfs:///ReleaseManagement/Release/304
2018-06-04T11:34:10.3036084Z ##[debug]Build.BuildUri=vstfs:///Build/Build/151
2018-06-04T11:34:10.3037014Z ##[debug]Release.DefinitionName=XXXXX_Release
2018-06-04T11:34:10.3037317Z ##[debug]Release.ReleaseName=Release-204
2018-06-04T11:34:10.3037980Z ##[debug]Build.BuildUri=vstfs:///Build/Build/151
2018-06-04T11:34:10.3038676Z ##[debug]Release.ReleaseWebUrl=https://YYYYY.visualstudio.com/1591217f-c442-4ac1-8afd-072c15f20d59/_release?releaseId=304&_a=release-summary
2018-06-04T11:34:10.3039189Z ##[debug]System.TeamFoundationCollectionUri=https://YYYYY.visualstudio.com/
2018-06-04T11:34:10.3039661Z ##[debug]System.TeamProjectId=1591217f-c442-4ac1-8afd-072c15f20d59
2018-06-04T11:34:10.3040063Z ##[debug]build.buildId=151
2018-06-04T11:34:10.3049416Z ##[debug][PUT]https://management.azure.com/subscriptions/GUID/resourceGroups/XXXXXAPP_RG/providers/microsoft.insights/components/XXXXXAPP/Annotations?api-version=2015-05-01
2018-06-04T11:34:11.1136052Z ##[debug]addReleaseAnnotation. Data : {"statusCode":200,"statusMessage":"OK","headers":{"cache-control":"no-cache","pragma":"no-cache","content-length":"353","content-type":"application/json; charset=utf-8","expires":"-1","x-ms-request-id":"195f5969-0b0c-4da3-bec2-323d858cba7c","x-content-type-options":"nosniff","strict-transport-security":"max-age=31536000; includeSubDomains","x-ms-ratelimit-remaining-subscription-writes":"1199","server":"Microsoft-IIS/8.5","x-powered-by":"ASP.NET","x-ms-correlation-request-id":"e3f218c9-cf92-43f9-a8a0-638343cd7177","x-ms-routing-request-id":"NORTHCENTRALUS:20180604T113411Z:e3f218c9-cf92-43f9-a8a0-638343cd7177","date":"Mon, 04 Jun 2018 11:34:10 GMT","connection":"close"},"body":[{"AnnotationName":"XXXXX_Release - Release-204","Id":"1df1e49f-6eca-4c77-87a1-b8dc22e180c0","Category":"Text","Properties":"{\"Label\":\"Success\",\"Deployment Uri\":\"https://YYYYY.visualstudio.com/1591217f-c442-4ac1-8afd-072c15f20d59/_release?releaseId=304&_a=release-summary\"}","EventTime":"2018-06-04T11:34:10.303+00:00","RelatedAnnotation":null}]}
2018-06-04T11:34:11.1138848Z Successfully added release annotation to the Application Insight : XXXXXAPP
2018-06-04T11:34:11.1142961Z ##[debug]build.sourceVersionAuthor=undefined
2018-06-04T11:34:11.1143466Z ##[debug]build.requestedfor=Sergey
2018-06-04T11:34:11.1143817Z ##[debug]build.buildUri=vstfs:///Build/Build/151
2018-06-04T11:34:11.1144142Z ##[debug]release.releaseUri=vstfs:///ReleaseManagement/Release/304
2018-06-04T11:34:11.1144511Z ##[debug]build.buildId=151
2018-06-04T11:34:11.1145581Z ##[debug]release.releaseId=304
2018-06-04T11:34:11.1146548Z ##[debug]build.buildNumber=R1.4_20180529
2018-06-04T11:34:11.1147174Z ##[debug]release.releaseName=Release-204
2018-06-04T11:34:11.1152875Z ##[debug]system.TeamFoundationCollectionUri=https://YYYYY.visualstudio.com/
2018-06-04T11:34:11.1153437Z ##[debug]system.teamProjectId=1591217f-c442-4ac1-8afd-072c15f20d59
2018-06-04T11:34:11.1153914Z ##[debug]build.sourceVersion=939
2018-06-04T11:34:11.1154283Z ##[debug]build.repository.name=XXXXX Application
2018-06-04T11:34:11.1155329Z ##[debug]build.repository.provider=TfsVersionControl
2018-06-04T11:34:11.1155740Z ##[debug]build.buildUri=vstfs:///Build/Build/151
2018-06-04T11:34:11.1156109Z ##[debug]release.releaseUri=vstfs:///ReleaseManagement/Release/304
2018-06-04T11:34:11.1156447Z ##[debug]build.buildId=151
2018-06-04T11:34:11.1157196Z ##[debug]release.releaseId=304
2018-06-04T11:34:11.1157610Z ##[debug]build.buildNumber=R1.4_20180529
2018-06-04T11:34:11.1158002Z ##[debug]release.releaseName=Release-204
2018-06-04T11:34:11.1158414Z ##[debug]system.TeamFoundationCollectionUri=https://YYYYY.visualstudio.com/
2018-06-04T11:34:11.1158848Z ##[debug]system.teamProjectId=1591217f-c442-4ac1-8afd-072c15f20d59
2018-06-04T11:34:11.1159230Z ##[debug]build.sourceVersion=939
2018-06-04T11:34:11.1159674Z ##[debug]build.repository.name=XXXXX Application
2018-06-04T11:34:11.1160241Z ##[debug]build.repository.provider=TfsVersionControl
2018-06-04T11:34:11.1165194Z ##[debug][PUT]https://$XXXXXAPP:***#XXXXXAPP.scm.azurewebsites.net/api/deployments/3041528112051114
2018-06-04T11:34:12.7504296Z ##[debug]updateDeployment. Data: {"statusCode":200,"statusMessage":"OK","headers":{"cache-control":"no-cache","pragma":"no-cache","content-length":"933","content-type":"application/json; charset=utf-8","expires":"-1","server":"Microsoft-IIS/10.0","x-ms-request-id":"9ad3446c-7bad-4d11-a827-d4f74de4c5e9","x-aspnet-version":"4.0.30319","x-powered-by":"ASP.NET","set-cookie":["ARRAffinity=8a8d8dd9156bbc837a024bd4b077d8299002a88a7be8967241d8478205e5f430;Path=/;HttpOnly;Domain=XXXXXAPP.scm.azurewebsites.net"],"date":"Mon, 04 Jun 2018 11:34:12 GMT","connection":"close"},"body":{"id":"3041528112051114","status":4,"status_text":null,"author_email":null,"author":"Sergey ","deployer":"VSTS","message":"{\"type\":\"Deployment\",\"commitId\":\"939\",\"buildId\":\"151\",\"releaseId\":\"304\",\"buildNumber\":\"R1.4_20180529\",\"releaseName\":\"Release-204\",\"repoProvider\":\"TfsVersionControl\",\"repoName\":\"XXXXX Application\",\"collectionUrl\":\"https://YYYYY.visualstudio.com/\",\"teamProject\":\"1591217f-c442-4ac1-8afd-072c15f20d59\",\"slotName\":\"production\"}","progress":null,"received_time":"0001-01-01T00:00:00","start_time":"2018-06-04T11:34:12.546166Z","end_time":"2018-06-04T11:34:12.546166Z","last_success_end_time":null,"complete":false,"active":true,"is_temp":false,"is_readonly":false,"url":"https://XXXXXAPP.scm.azurewebsites.net/api/deployments/3041528112051114","log_url":"https://XXXXXAPP.scm.azurewebsites.net/api/deployments/3041528112051114/log","site_name":null}}
2018-06-04T11:34:12.7506684Z Successfully updated deployment History at https://XXXXXAPP.scm.azurewebsites.net/api/deployments/3041528112051114
2018-06-04T11:34:12.7647383Z ##[section]Finishing: Deploy Azure App Service
I've added the step to clean the wwwroot folder content (using Kudu REST API and COMMAND verb).
After completion, the directory looks like:
After clean, the deploy is performed correctly.
I am wondering why application redeploy (update) doesn't change the necessary files.
Please try with the Azure App Service Deploy task with 4.* (preview) version, and select your App Service type correspondingly.

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.

Deploy Service Fabric Application through VSTS release pipeline using Hosted Agent

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).

Resources