Skip to content

[BUG]: AzureFileCopy V6 fails to authenticate #21209

@BenjaminBrienen

Description

@BenjaminBrienen

New issue checklist

Task name

AzureFileCopy

Task version

6.259.3

Issue Description

The task fails consistently on random build agents.

See Azure/azure-storage-azcopy#3155

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows 11

Relevant log output

& "AzCopy_Prev\AzCopy\AzCopy.exe" copy "C:\cagnt03\_work\2161\a\REDACTED" "[https://ostrdev001oesweu1.blob.core.windows.net/runbooks/"](https://ostrdev001oesweu1.blob.core.windows.net/REDACTED/%22) --log-level=INFO --recursive
INFO: Scanning...
INFO: Proxy detected: https://azcopyvnextrelease.blob.core.windows.net/ -> //REDACTED

Failed to perform Auto-login: PSContextCredentialGet-AzAccessToken: -REDACTED-;1mRun Connect-AzAccount to login.
.

Full task logs with system.debug enabled

``` 2025-08-11T18:46:05.1655583Z ##[section]Starting: Copy runbook to StorageAccount 2025-08-11T18:46:05.1659991Z ============================================================================== 2025-08-11T18:46:05.1660074Z Task : Azure file copy 2025-08-11T18:46:05.1660112Z Description : Copy files to Azure Blob Storage or virtual machines 2025-08-11T18:46:05.1660177Z Version : 6.259.3 2025-08-11T18:46:05.1660216Z Author : Microsoft Corporation 2025-08-11T18:46:05.1660265Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy 2025-08-11T18:46:05.1660323Z ============================================================================== 2025-08-11T18:46:06.4611360Z Added TLS 1.2 in session. 2025-08-11T18:46:06.6272058Z ##[command]Import-Module -Name C:\Users\REDACTED\Documents\PowerShell\Modules\Az.Accounts\4.0.2\Az.Accounts.psd1 -Global 2025-08-11T18:46:07.5438162Z ##[command]Update-AzConfig -CheckForUpgrade False -AppliesTo Az -Scope Process 2025-08-11T18:46:07.6324642Z 2025-08-11T18:46:07.6968822Z ##[command]Get-AzConfig -AppliesTo Az 2025-08-11T18:46:07.7369600Z ##[command]Update-AzConfig -DisplayBreakingChangeWarning False -AppliesTo Az -Scope Process 2025-08-11T18:46:07.7612585Z ##[command]Enable-AzureRmAlias -Scope Process 2025-08-11T18:46:08.2158715Z ##[command]Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue 2025-08-11T18:46:08.3615801Z ##[command]Clear-AzContext -Scope Process 2025-08-11T18:46:08.3954235Z ##[command]Clear-AzConfig -DefaultSubscriptionForLogin 2025-08-11T18:46:08.4471318Z ##[command]Connect-AzAccount 2025-08-11T18:46:08.4471752Z Name Value 2025-08-11T18:46:08.4471979Z ---- ----- 2025-08-11T18:46:08.4472191Z Tenant REDACTED 2025-08-11T18:46:08.4472467Z Scope Process 2025-08-11T18:46:08.4472745Z Environment AzureCloud 2025-08-11T18:46:08.4473018Z Credential System.Management.Automation.PSCredential 2025-08-11T18:46:08.4473772Z WarningAction SilentlyContinue 2025-08-11T18:46:08.4474100Z ServicePrincipal True 2025-08-11T18:46:08.4474182Z 2025-08-11T18:46:08.4474239Z 2025-08-11T18:46:08.4474307Z 2025-08-11T18:46:09.5005068Z Key Value Applies To Scope Help Message 2025-08-11T18:46:09.5009895Z --- ----- ---------- ----- ------------ 2025-08-11T18:46:09.5034120Z CheckForUpgrade False Az Process When enabled, Azure PowerShell will check for updates automati... 2025-08-11T18:46:09.5058398Z DisplayBreakingChangeWarning False Az Process Controls if warning messages for breaking changes are displaye... 2025-08-11T18:46:09.5058566Z 2025-08-11T18:46:09.5060536Z Environments : {[AzureChinaCloud, AzureChinaCloud], [AzureCloud, AzureCloud], [AzureUSGovernment, AzureUSGovernment]} 2025-08-11T18:46:09.5061073Z Context : Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext 2025-08-11T18:46:09.5061351Z 2025-08-11T18:46:09.5900466Z ##[command]Set-AzContext 2025-08-11T18:46:09.5900723Z Name Value 2025-08-11T18:46:09.5900893Z ---- ----- 2025-08-11T18:46:09.5902743Z SubscriptionId REDACTED 2025-08-11T18:46:09.5902819Z 2025-08-11T18:46:09.5902857Z 2025-08-11T18:46:09.5902901Z 2025-08-11T18:46:10.1654506Z 2025-08-11T18:46:10.1660754Z Name : REDACTED - 2025-08-11T18:46:10.1661468Z REDACTED - *** 2025-08-11T18:46:10.1662151Z Subscription : REDACTED 2025-08-11T18:46:10.1662686Z Account : *** 2025-08-11T18:46:10.1662925Z Environment : AzureCloud 2025-08-11T18:46:10.1663999Z Tenant : REDACTED 2025-08-11T18:46:10.1664234Z TokenCache : 2025-08-11T18:46:10.1664409Z VersionProfile : 2025-08-11T18:46:10.1665239Z ExtendedProperties : {} 2025-08-11T18:46:10.1665506Z 2025-08-11T18:46:10.5102968Z ##[command]Import-Module -Name C:\Users\REDACTED\Documents\PowerShell\Modules\Az.Resources\7.8.1\Az.Resources.psd1 -Global 2025-08-11T18:46:12.4190659Z ##[command]Import-Module -Name C:\Users\REDACTED\Documents\PowerShell\Modules\Az.Storage\8.1.0\Az.Storage.psd1 -Global 2025-08-11T18:46:12.9188981Z ##[command]Import-Module -Name C:\Users\REDACTED\Documents\PowerShell\Modules\Az.Compute\9.1.0\Az.Compute.psd1 -Global 2025-08-11T18:46:13.7590737Z ##[command]Import-Module -Name C:\Users\REDACTED\Documents\PowerShell\Modules\Az.Network\7.14.0\Az.Network.psd1 -Global 2025-08-11T18:46:16.7653277Z mime: C:\cagnt02\_work\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\6.259.3\MimeMapping.json 2025-08-11T18:46:16.7693749Z Uploading files from source path: 'C:\cagnt02\_work\2021\a\runbook\Runbook.ps1' to storage account: 'REDACTED' in container: 'runbooks' with blob prefix: '' 2025-08-11T18:46:16.7799219Z ##[command] & "AzCopy_Prev\AzCopy\AzCopy.exe" copy "C:\cagnt02\_work\2021\a\runbook\Runbook.ps1" "https://ostrdev001oesweu1.blob.core.windows.net/runbooks/" --log-level=INFO --recursive 2025-08-11T18:46:16.8274988Z INFO: Scanning... 2025-08-11T18:46:16.8558993Z INFO: Proxy detected: https://azcopyvnextrelease.blob.core.windows.net -> //REDACTED:81 2025-08-11T18:46:25.2892694Z INFO: Login with Powershell context succeeded 2025-08-11T18:46:25.2893647Z INFO: Authenticating to destination using Azure AD 2025-08-11T18:46:25.2898553Z INFO: Any empty folders will not be processed, because source and/or destination doesn't have full folder support 2025-08-11T18:46:25.2988394Z 2025-08-11T18:46:25.2988801Z Job a1adc5a0-df36-7548-4224-ccfc4287c7f0 has started 2025-08-11T18:46:25.2989087Z Log file is located at: C:\Users\REDACTED\.azcopy\a1adc5a0-df36-7548-4224-ccfc4287c7f0.log 2025-08-11T18:46:25.2989229Z 2025-08-11T18:46:27.0793805Z INFO: Proxy detected: https://ostrdev001oesweu1.blob.core.windows.net -> //REDACTED:81 2025-08-11T18:46:27.2990546Z 2025-08-11T18:46:27.2991040Z 100.0 %, 1 Done, 0 Failed, 0 Pending, 0 Skipped, 1 Total, 2-sec Throughput (Mb/s): 0.0008 2025-08-11T18:46:27.2991248Z 2025-08-11T18:46:27.2991456Z 2025-08-11T18:46:27.2991708Z Job a1adc5a0-df36-7548-4224-ccfc4287c7f0 summary 2025-08-11T18:46:27.2991915Z Elapsed Time (Minutes): 0.0334 2025-08-11T18:46:27.2992100Z Number of File Transfers: 1 2025-08-11T18:46:27.2992283Z Number of Folder Property Transfers: 0 2025-08-11T18:46:27.2992467Z Number of Symlink Transfers: 0 2025-08-11T18:46:27.2992646Z Total Number of Transfers: 1 2025-08-11T18:46:27.2992827Z Number of File Transfers Completed: 1 2025-08-11T18:46:27.2993018Z Number of Folder Transfers Completed: 0 2025-08-11T18:46:27.2993203Z Number of File Transfers Failed: 0 2025-08-11T18:46:27.2993384Z Number of Folder Transfers Failed: 0 2025-08-11T18:46:27.2993565Z Number of File Transfers Skipped: 0 2025-08-11T18:46:27.2994864Z Number of Folder Transfers Skipped: 0 2025-08-11T18:46:27.2995059Z Total Number of Bytes Transferred: 188 2025-08-11T18:46:27.2995245Z Final Job Status: Completed 2025-08-11T18:46:27.2995322Z 2025-08-11T18:46:27.3090478Z Uploaded files successfully from source path: 'C:\cagnt02\_work\2021\a\runbook\Runbook.ps1' to storage account: 'ostrdev001oesweu1' in container: 'runbooks' with blob prefix: '' 2025-08-11T18:46:27.3639228Z ##[command]Disconnect-AzAccount -Scope Process -ErrorAction Stop 2025-08-11T18:46:27.3930299Z ##[command]Clear-AzContext -Scope Process -ErrorAction Stop 2025-08-11T18:46:27.4186077Z 2025-08-11T18:46:27.4186276Z 2025-08-11T18:46:27.4689983Z ##[section]Finishing: Copy runbook to StorageAccount ```
2025-08-08T10:09:27.0688944Z ##[section]Starting: Copy runbook to StorageAccount
2025-08-08T10:09:27.0695000Z ==============================================================================
2025-08-08T10:09:27.0695120Z Task         : Azure file copy
2025-08-08T10:09:27.0695174Z Description  : Copy files to Azure Blob Storage or virtual machines
2025-08-08T10:09:27.0695280Z Version      : 6.259.3
2025-08-08T10:09:27.0695329Z Author       : Microsoft Corporation
2025-08-08T10:09:27.0695385Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy
2025-08-08T10:09:27.0695498Z ==============================================================================
2025-08-08T10:09:28.5577727Z Added TLS 1.2 in session.
2025-08-08T10:09:28.7303369Z ##[command]Import-Module -Name C:\Users\REDACTED\Documents\PowerShell\Modules\Az.Accounts\4.0.2\Az.Accounts.psd1 -Global
2025-08-08T10:09:29.7704300Z ##[command]Update-AzConfig -CheckForUpgrade False -AppliesTo Az -Scope Process
2025-08-08T10:09:29.8817332Z 
2025-08-08T10:09:29.9452272Z ##[command]Get-AzConfig -AppliesTo Az
2025-08-08T10:09:29.9876473Z ##[command]Update-AzConfig -DisplayBreakingChangeWarning False -AppliesTo Az -Scope Process
2025-08-08T10:09:30.0090869Z ##[command]Enable-AzureRmAlias -Scope Process
2025-08-08T10:09:30.7008085Z ##[command]Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
2025-08-08T10:09:30.7721746Z ##[command]Clear-AzContext -Scope Process
2025-08-08T10:09:30.7939954Z ##[command]Clear-AzConfig -DefaultSubscriptionForLogin
2025-08-08T10:09:30.8368002Z ##[command]Connect-AzAccount 
2025-08-08T10:09:30.8368394Z Name                           Value                                                                                   
2025-08-08T10:09:30.8368976Z ----                           -----                                                                                   
2025-08-08T10:09:30.8369621Z Tenant                         REDACTED                                                    
2025-08-08T10:09:30.8369982Z Scope                          Process                                                                                 
2025-08-08T10:09:30.8370194Z Environment                    AzureCloud                                                                              
2025-08-08T10:09:30.8370434Z Credential                     System.Management.Automation.PSCredential                                               
2025-08-08T10:09:30.8370676Z WarningAction                  SilentlyContinue                                                                        
2025-08-08T10:09:30.8370892Z ServicePrincipal               True                                                                                    
2025-08-08T10:09:30.8370979Z 
2025-08-08T10:09:30.8371039Z 
2025-08-08T10:09:30.8371106Z 
2025-08-08T10:09:31.9319645Z Key                          Value Applies To Scope   Help Message                                                     
2025-08-08T10:09:31.9321932Z ---                          ----- ---------- -----   ------------                                                     
2025-08-08T10:09:31.9339128Z CheckForUpgrade              False Az         Process When enabled, Azure PowerShell will check for updates automati...
2025-08-08T10:09:31.9355291Z DisplayBreakingChangeWarning False Az         Process Controls if warning messages for breaking changes are displaye...
2025-08-08T10:09:31.9355709Z 
2025-08-08T10:09:31.9356264Z Environments : {[AzureCloud, AzureCloud], [AzureChinaCloud, AzureChinaCloud], [AzureUSGovernment, AzureUSGovernment]}
2025-08-08T10:09:31.9356611Z Context      : Microsoft.Azure.Commands.Profile.Models.Core.PSAzureContext
2025-08-08T10:09:31.9356807Z 
2025-08-08T10:09:32.0117282Z ##[command]Set-AzContext 
2025-08-08T10:09:32.0117656Z Name                           Value                                                                                   
2025-08-08T10:09:32.0118157Z ----                           -----                                                                                   
2025-08-08T10:09:32.0120300Z SubscriptionId                 REDACTED                                                    
2025-08-08T10:09:32.0120417Z 
2025-08-08T10:09:32.0120487Z 
2025-08-08T10:09:32.0120545Z 
2025-08-08T10:09:32.6944414Z 
2025-08-08T10:09:32.6948935Z Name               : REDACTED - 
2025-08-08T10:09:32.6949513Z                      REDACTED - ***
2025-08-08T10:09:32.6949775Z Subscription       : REDACTED
2025-08-08T10:09:32.6950094Z Account            : ***
2025-08-08T10:09:32.6950485Z Environment        : AzureCloud
2025-08-08T10:09:32.6951198Z Tenant             : REDACTED
2025-08-08T10:09:32.6951430Z TokenCache         : 
2025-08-08T10:09:32.6951900Z VersionProfile     : 
2025-08-08T10:09:32.6952507Z ExtendedProperties : {}
2025-08-08T10:09:32.6952620Z 
2025-08-08T10:09:33.1032652Z ##[command]Import-Module -Name C:\Users\REDACTED\Documents\PowerShell\Modules\Az.Resources\7.8.1\Az.Resources.psd1 -Global
2025-08-08T10:09:35.5657166Z ##[command]Import-Module -Name C:\Users\REDACTED\Documents\PowerShell\Modules\Az.Storage\8.1.0\Az.Storage.psd1 -Global
2025-08-08T10:09:36.1930662Z ##[command]Import-Module -Name C:\Users\REDACTED\Documents\PowerShell\Modules\Az.Compute\9.1.0\Az.Compute.psd1 -Global
2025-08-08T10:09:37.5179525Z ##[command]Import-Module -Name C:\Users\REDACTED\Documents\PowerShell\Modules\Az.Network\7.14.0\Az.Network.psd1 -Global
2025-08-08T10:09:40.5169303Z  mime: C:\cagnt03\_work\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\6.259.3\MimeMapping.json
2025-08-08T10:09:40.5210860Z Uploading files from source path: 'C:\cagnt03\_work\2161\a\runbook\Runbook.ps1' to storage account: 'ostrdev001oesweu1' in container: 'runbooks' with blob prefix: ''
2025-08-08T10:09:40.5303823Z ##[command] & "AzCopy_Prev\AzCopy\AzCopy.exe" copy "C:\cagnt03\_work\2161\a\runbook\Runbook.ps1" "https://ostrdev001oesweu1.blob.core.windows.net/runbooks/" --log-level=INFO --recursive
2025-08-08T10:09:40.5996527Z INFO: Scanning...
2025-08-08T10:09:40.6304789Z INFO: Proxy detected: https://azcopyvnextrelease.blob.core.windows.net -> //REDACTED:81
2025-08-08T10:09:41.8299760Z 
2025-08-08T10:09:41.8300636Z Failed to perform Auto-login: PSContextCredential�[31;1mGet-AzAccessToken: -REDACTED-;1mRun Connect-AzAccount to login.�[0m
2025-08-08T10:09:41.8300822Z .
2025-08-08T10:09:41.9420572Z ##[command]Disconnect-AzAccount -Scope Process -ErrorAction Stop
2025-08-08T10:09:41.9702762Z ##[command]Clear-AzContext -Scope Process -ErrorAction Stop
2025-08-08T10:09:42.0473103Z ##[error]Upload to container: 'runbooks' in storage account: 'ostrdev001oesweu1' with blob prefix: '' failed with error: 'AzCopy.exe exited with non-zero exit code while uploading files to blob storage.' For more info please refer to https://aka.ms/azurefilecopyreadme
2025-08-08T10:09:42.0980128Z ##[section]Finishing: Copy runbook to StorageAccount

Repro steps

Unknown what causes this

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions