Azure-pipelines-tasks: Performing Windows Machine File Copy using user with '$' character fails with "The user context supplied is invalid."

Created on 4 May 2017  路  4Comments  路  Source: microsoft/azure-pipelines-tasks

Copying failed for resource : {fqdnofhost}
Failed to connect to the path \{fqdnofhost} with the user domain\$build for copying.
The user context supplied is invalid.
More help is available by typing NET HELPMSG 3775.

If I use another account with the same permissions, but no '$' the task completes successfully.

Release bug

Most helpful comment

Hi @jsblock78 , we found this to be a bug in the task. We will discuss with our pm team to take this up as an enhancement

All 4 comments

Hi @jsblock78 , in "domain$build", is "build" a variable that you are specifying? If yes, the correct way to use it would be to use it like so "domain$(build)" . If you mean something else, then please share the full debug logs with us at [email protected] . You can generate the full debug logs by setting the system.debug variable to true in the variables tab.

I guess our IT has a policy that service accounts should start with a dollar sign. The username itself has a $ symbol in it. The paste above seemed to drop the backslash.

For example: mydomain\$thisuser

The username is $thisuser for domain mydomain.

2017-05-12T21:49:30.6240197Z Executing the powershell script: C:VSAgent\tasks\WindowsMachineFileCopy\1.0.23\WindowsMachineFileCopy.ps1

2017-05-12T21:49:32.6838963Z ##[debug]Entering script WindowsMachineFileCopy.ps1

2017-05-12T21:49:32.6838963Z ##[debug]environmentName = reg3a-test.fpe.boi.rd.renamed.net:5986

2017-05-12T21:49:32.6838963Z ##[debug]adminUserName = auth\$tfsbuild001

2017-05-12T21:49:32.6838963Z ##[debug]resourceFilteringMethod = machineNames

2017-05-12T21:49:32.6838963Z ##[debug]machineNames =

2017-05-12T21:49:32.6838963Z ##[debug]sourcePath = \regagent1.fpe.boi.rd.renamed.netVSBits\FmsBvtGatedMain\FmsBvtGatedMain_20170512.12\Testing

2017-05-12T21:49:32.6838963Z ##[debug]targetPath = C:VSTests

2017-05-12T21:49:32.6838963Z ##[debug]additionalArguments =

2017-05-12T21:49:32.6838963Z ##[debug]copyFilesInParallel = true

2017-05-12T21:49:32.6838963Z ##[debug]cleanTargetBeforeCopy = true

2017-05-12T21:49:32.8020016Z ##[debug]Loading module from path 'C:VSAgent\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Common\Microsoft.TeamFoundation.DistributedTask.Task.Common.dll'.

2017-05-12T21:49:32.8332478Z ##[debug]Importing cmdlet 'Complete-Task'.

2017-05-12T21:49:32.8332478Z ##[debug]Importing cmdlet 'Get-LocalizedString'.

2017-05-12T21:49:32.8332478Z ##[debug]Importing cmdlet 'Set-TaskVariable'.

2017-05-12T21:49:32.8332478Z ##[debug]Importing cmdlet 'Set-TaskProgress'.

2017-05-12T21:49:32.8332478Z ##[debug]Importing cmdlet 'Add-TaskIssue'.

2017-05-12T21:49:32.8332478Z ##[debug]Importing cmdlet 'Write-TaskDetail'.

2017-05-12T21:49:32.8332478Z ##[debug]Importing cmdlet 'Find-Files'.

2017-05-12T21:49:32.8644988Z ##[debug]Loading module from path 'C:VSAgent\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Internal\Microsoft.TeamFoundation.DistributedTask.Task.Internal.dll'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Add-BuildAttachment'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Convert-String'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Get-IndexedSourceFilePaths'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Get-JavaDevelopmentKitPath'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Get-MSBuildLocation'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Get-ServiceEndpoint'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Get-TfsClientCredentials'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Get-ToolPath'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Get-TaskVariable'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Get-VisualStudioPath'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Get-VssConnection'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Invoke-Ant'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Invoke-BatchScript'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Invoke-Maven'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Invoke-MSBuild'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Invoke-PublishSymbols'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Invoke-Tool'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Invoke-VSTest'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Publish-BuildArtifact'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Copy-BuildArtifact'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Add-BuildArtifactLink'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Register-XamarinLicense'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Unregister-XamarinLicense'.

2017-05-12T21:49:32.8801220Z ##[debug]Importing cmdlet 'Get-X509Certificate'.

2017-05-12T21:49:32.8801220Z ##[debug]Loading module from path 'C:VSAgent\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.DevTestLabs\Microsoft.TeamFoundation.DistributedTask.Task.DevTestLabs.dll'.

2017-05-12T21:49:32.9582458Z ##[debug]Importing cmdlet 'Get-ExternalIpAddress'.

2017-05-12T21:49:32.9582458Z ##[debug]Importing cmdlet 'Get-ParsedSessionVariables'.

2017-05-12T21:49:32.9582458Z ##[debug]Importing cmdlet 'Invoke-UnblockEnvironment'.

2017-05-12T21:49:32.9582458Z ##[debug]Importing cmdlet 'Copy-FilesToAzureBlob'.

2017-05-12T21:49:32.9582458Z ##[debug]Importing cmdlet 'Copy-ToAzureMachines'.

2017-05-12T21:49:32.9582458Z ##[debug]Importing cmdlet 'Remove-EnvironmentResources'.

2017-05-12T21:49:32.9582458Z ##[debug]Importing cmdlet 'Copy-FilesToTargetMachine'.

2017-05-12T21:49:32.9582458Z ##[debug]Importing cmdlet 'Remove-Environment'.

2017-05-12T21:49:32.9582458Z ##[debug]Importing cmdlet 'Invoke-BlockEnvironment'.

2017-05-12T21:49:32.9582458Z ##[debug]Importing cmdlet 'Complete-EnvironmentResourceOperation'.

2017-05-12T21:49:32.9582458Z ##[debug]Importing cmdlet 'New-OperationLog'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Register-EnvironmentDefinition'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Register-Environment'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Register-Provider'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Register-ProviderData'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Invoke-PsOnRemote'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Get-Environment'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Get-EnvironmentResources'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Get-EnvironmentProperty'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Get-ProviderData'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Complete-EnvironmentOperation'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Complete-ResourceOperation'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Invoke-ResourceOperation'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Invoke-EnvironmentOperation'.

2017-05-12T21:49:32.9738703Z ##[debug]Importing cmdlet 'Copy-FilesToRemote'.

2017-05-12T21:49:36.0837879Z ##[debug]Starting Register-Environment cmdlet call for environment : reg3a-test.fpe.boi.rd.renamed.net:5986 with filter

2017-05-12T21:49:36.2556592Z ##[debug]Completed Register-Environment cmdlet call for environment : reg3a-test.fpe.boi.rd.renamed.net:5986

2017-05-12T21:49:36.2556592Z ##[debug]Starting Get-EnvironmentResources cmdlet call on environment name: reg3a-test.fpe.boi.rd.renamed.net:5986

2017-05-12T21:49:36.3025331Z ##[debug]Completed Get-EnvironmentResources cmdlet call for environment name: reg3a-test.fpe.boi.rd.renamed.net:5986

2017-05-12T21:49:36.3962814Z ##[debug]Get Resource properties for reg3a-test.fpe.boi.rd.renamed.net (ResourceId = 1)

2017-05-12T21:49:36.3962814Z ##[debug] Starting Get-EnvironmentProperty cmdlet call on environment name: reg3a-test.fpe.boi.rd.renamed.net:5986 with resource id: 1(Name : reg3a-test.fpe.boi.rd.renamed.net) and key: Microsoft-Vslabs-MG-Resource-FQDN

2017-05-12T21:49:36.3962814Z ##[debug] Completed Get-EnvironmentProperty cmdlet call on environment name: reg3a-test.fpe.boi.rd.renamed.net:5986 with resource id: 1(Name : reg3a-test.fpe.boi.rd.renamed.net) and key: Microsoft-Vslabs-MG-Resource-FQDN

2017-05-12T21:49:36.3962814Z ##[debug] Resource fqdn - reg3a-test.fpe.boi.rd.renamed.net

2017-05-12T21:49:36.4275306Z ##[debug] Resource Username - auth\$tfsbuild001

2017-05-12T21:49:36.4744040Z Copy started for - 'reg3a-test.fpe.boi.rd.renamed.net'

2017-05-12T21:49:36.6150266Z ##[debug]Loading .NET assembly: Microsoft.IdentityModel.Clients.ActiveDirectory.dll

2017-05-12T21:49:36.6619008Z ##[debug]Loading .NET assembly: Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll

2017-05-12T21:49:36.7712738Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Build.Client.dll

2017-05-12T21:49:36.8337721Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Build.Common.dll

2017-05-12T21:49:36.8650221Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Build.VsTestLogger.dll

2017-05-12T21:49:36.8650221Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Build2.WebApi.dll

2017-05-12T21:49:36.8806458Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Chat.WebApi.dll

2017-05-12T21:49:36.8806458Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Client.dll

2017-05-12T21:49:36.8962713Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Common.dll

2017-05-12T21:49:36.9431454Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Core.WebApi.dll

2017-05-12T21:49:36.9743950Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.DeleteTeamProject.dll

2017-05-12T21:49:37.0056437Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Diff.dll

2017-05-12T21:49:37.0681432Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Discussion.Client.dll

2017-05-12T21:49:37.0681432Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.DistributedTask.Agent.Common.dll

2017-05-12T21:49:37.0681432Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.DistributedTask.Agent.Interfaces.dll

2017-05-12T21:49:37.0681432Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.DistributedTask.Agent.Logger.dll

2017-05-12T21:49:37.0681432Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.DistributedTask.Agent.Strings.dll

2017-05-12T21:49:37.0681432Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.DistributedTask.Agent.Worker.Common.dll

2017-05-12T21:49:37.1150171Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll

2017-05-12T21:49:37.1150171Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.DistributedTask.WebApi.dll

2017-05-12T21:49:37.1150171Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.DistributedTask.Worker.dll

2017-05-12T21:49:37.1462666Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Git.Client.dll

2017-05-12T21:49:37.3181394Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Lab.Client.dll

2017-05-12T21:49:37.3806366Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Lab.Common.dll

2017-05-12T21:49:37.4118872Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Lab.TestIntegration.Client.dll

2017-05-12T21:49:37.4431358Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Lab.WorkflowIntegration.Client.dll

2017-05-12T21:49:37.4900103Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Policy.WebApi.dll

2017-05-12T21:49:37.5368826Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.ProjectManagement.dll

2017-05-12T21:49:37.6306315Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.SharePointReporting.Integration.dll

2017-05-12T21:49:37.7087550Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.SourceControl.WebApi.dll

2017-05-12T21:49:37.7400053Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Test.WebApi.dll

2017-05-12T21:49:37.7712549Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.TestImpact.Client.dll

2017-05-12T21:49:37.8806265Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.TestManagement.Client.dll

2017-05-12T21:49:37.9118765Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.TestManagement.Common.dll

2017-05-12T21:49:38.0212518Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.TestManagement.WebApi.dll

2017-05-12T21:49:38.0212518Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.VersionControl.Client.dll

2017-05-12T21:49:38.0368747Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.VersionControl.Common.dll

2017-05-12T21:49:38.0837484Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.VersionControl.Common.Integration.dll

2017-05-12T21:49:38.1149988Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.Work.WebApi.dll

2017-05-12T21:49:38.1306212Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll

2017-05-12T21:49:38.1774968Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.WorkItemTracking.Client.dll

2017-05-12T21:49:38.2243708Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage.dll

2017-05-12T21:49:38.3024949Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.WorkItemTracking.Common.dll

2017-05-12T21:49:38.3493687Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.WorkItemTracking.Proxy.dll

2017-05-12T21:49:38.4118674Z ##[debug]Loading .NET assembly: Microsoft.TeamFoundation.WorkItemTracking.WebApi.dll

2017-05-12T21:49:38.4118674Z ##[debug]Loading .NET assembly: Microsoft.VisualStudio.Services.Client.dll

2017-05-12T21:49:38.4431165Z ##[debug]Loading .NET assembly: Microsoft.VisualStudio.Services.CodeReview.Common.dll

2017-05-12T21:49:38.4743646Z ##[debug]Loading .NET assembly: Microsoft.VisualStudio.Services.CodeReview.Discussion.WebApi.dll

2017-05-12T21:49:38.5524913Z ##[debug]Loading .NET assembly: Microsoft.VisualStudio.Services.CodeReview.WebApi.dll

2017-05-12T21:49:38.5524913Z ##[debug]Loading .NET assembly: Microsoft.VisualStudio.Services.Common.dll

2017-05-12T21:49:38.5524913Z ##[debug]Loading .NET assembly: Microsoft.VisualStudio.Services.WebApi.dll

2017-05-12T21:49:38.5524913Z ##[debug]Loading .NET assembly: Newtonsoft.Json.dll

2017-05-12T21:49:38.5524913Z ##[debug]Loading .NET assembly: System.Net.Http.Formatting.dll

2017-05-12T21:49:38.5681143Z ##[debug]Importing cmdlet 'Complete-Task'.

2017-05-12T21:49:38.5681143Z ##[debug]Importing cmdlet 'Get-LocalizedString'.

2017-05-12T21:49:38.5681143Z ##[debug]Importing cmdlet 'Set-TaskVariable'.

2017-05-12T21:49:38.5681143Z ##[debug]Importing cmdlet 'Set-TaskProgress'.

2017-05-12T21:49:38.5681143Z ##[debug]Importing cmdlet 'Add-TaskIssue'.

2017-05-12T21:49:38.5681143Z ##[debug]Importing cmdlet 'Write-TaskDetail'.

2017-05-12T21:49:38.5681143Z ##[debug]Importing cmdlet 'Find-Files'.

2017-05-12T21:50:00.1601471Z ##[error]System.Management.Automation.RuntimeException: Copying failed for resource : reg3a-test.fpe.boi.rd.renamed.net

2017-05-12T21:50:00.1601471Z ##[error] Failed to connect to the path \reg3a-test.fpe.boi.rd.renamed.net with the user auth\$tfsbuild001 for copying.

2017-05-12T21:50:00.1601471Z ##[error] The user context supplied is invalid.

2017-05-12T21:50:00.1601471Z ##[error] More help is available by typing NET HELPMSG 3775.

2017-05-12T21:50:00.1757691Z ##[error]

2017-05-12T21:50:00.1757691Z ##[error] ---> System.Management.Automation.RuntimeException: Copying failed for resource : reg3a-test.fpe.boi.rd.renamed.net

2017-05-12T21:50:00.1757691Z ##[error] Failed to connect to the path \reg3a-test.fpe.boi.rd.renamed.net with the user auth\$tfsbuild001 for copying.

2017-05-12T21:50:00.1757691Z ##[error] The user context supplied is invalid.

2017-05-12T21:50:00.1757691Z ##[error] More help is available by typing NET HELPMSG 3775.

2017-05-12T21:50:00.1757691Z ##[error]

2017-05-12T21:50:00.1757691Z ##[error] --- End of inner exception stack trace ---

2017-05-12T21:50:00.1757691Z ##[error] at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)

2017-05-12T21:50:00.1757691Z ##[error] at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)

2017-05-12T21:50:00.1757691Z ##[error] at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)

2017-05-12T21:50:00.1757691Z ##[error] at System.Management.Automation.PowerShell.CoreInvokeHelperTInput,TOutput

2017-05-12T21:50:00.1757691Z ##[error] at System.Management.Automation.PowerShell.CoreInvokeTInput,TOutput

2017-05-12T21:50:00.1757691Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Handlers.PowerShellHandler.Execute(ITaskContext context, CancellationToken cancellationToken)

2017-05-12T21:50:00.1757691Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.RunTask(ITaskContext context, TaskWrapper task, CancellationTokenSource tokenSource)

Hi @jsblock78 , we found this to be a bug in the task. We will discuss with our pm team to take this up as an enhancement

This issue has been fixed is master branch

PR - https://github.com/Microsoft/vsts-tasks/pull/5637

It will get deployed with next release deployment

Was this page helpful?
0 / 5 - 0 ratings