azure-pipelines-tasks: [REGRESSION]: AzureFileCopy@6 failing to load Az.Accounts v3.0.0 module
New issue checklist
- I searched for existing GitHub issues
- I read pipeline troubleshooting guide
- I checked how to collect logs
Task name
AzureFileCopy
Breaking task version
6.240.1
Last working task version
6.239.x
Regression Description
We have a pipeline that is using AzureFileCopy@6 with a managed identity. It has been in place for about 2 weeks and has been running without issue. On Tuesday the task started failing with the only visible change in the logs being the Az.Accounts module updating from v2.9.1 to v3.0.0.
When it fails, we get this error:
Failed to perform Auto-login: PSContextCredentialGet-AzAccessToken: -REDACTED- 'Get-AzAccessToken' command was found in the module 'Az.Accounts', but the module could not be loaded. For more information, run 'Import-Module Az.Accounts'.
In failed runs the listed Az.Accounts module version is always v3.0.0.
Imported module 'Az.Accounts', version: 3.0.0
Runs that executed earlier which passed have a version of v2.9.1.
Imported module 'Az.Accounts', version: 2.9.1
Cross contamination of jobs is not possible because a fresh machine with the exact same configuration is used for each run and that configuration has not changed.
I believe it may have been caused by this change from AzureRM to Az: https://github.com/microsoft/azure-pipelines-tasks/commit/f5b22d9c64118dc809b217a09e4e5d8599939429
Example runs:
Pass: v2.9.1
https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=9600629&view=logs&j=4736f78b-748e-51a8-c3dc-ea7706a06c3d&t=f124d820-a316-55db-635e-ba56d272505a
Fail: v3.0.0
https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=9613411&view=logs&j=4736f78b-748e-51a8-c3dc-ea7706a06c3d&t=f124d820-a316-55db-635e-ba56d272505a
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
Starting: Upload to Storage
==============================================================================
Task : Azure file copy
Description : Copy files to Azure Blob Storage or virtual machines
Version : 6.240.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy
==============================================================================
Import-Module -Name C:\Program Files\WindowsPowerShell\Modules\Az.Accounts\3.0.0\Az.Accounts.psd1 -Global -PassThru -Force
##[warning]Both Az and AzureRM modules were detected on this machine. Az and AzureRM modules cannot be imported in the same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. If you are running in Azure Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found here: https://aka.ms/azps-migration-guide
Imported module 'Az.Accounts', version: 3.0.0
Update-AzConfig -DisplayBreakingChangeWarning False -AppliesTo Az
Enable-AzureRmAlias -Scope Process
Import-Module -Name C:\Program Files\WindowsPowerShell\Modules\Az.Resources\1.13.0\Az.Resources.psd1 -Global -PassThru -Force
Imported module 'Az.Resources', version: 1.13.0
Import-Module -Name C:\Program Files\WindowsPowerShell\Modules\Az.Storage\1.14.0\Az.Storage.psd1 -Global -PassThru -Force
Imported module 'Az.Storage', version: 1.14.0
Uninstall-AzureRm
Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue
Clear-AzContext -Scope Process
Connect-AzAccount
......
Failed to perform Auto-login: PSContextCredentialGet-AzAccessToken: -REDACTED- 'Get-AzAccessToken' command was found in the module 'Az.Accounts', but the module could not be loaded. For more information, run 'Import-Module Az.Accounts'.
Full task logs with system.debug enabled
We don’t have full task logs with system.debug enabled.
Repro steps
- task: AzureFileCopy@6
displayName: 'Azure File Copy'
inputs:
SourcePath: '${{ parameters.BuildPackages }}'
azureSubscription: ${{ parameters.AzureSubscription }}
Destination: AzureBlob
storage: ${{ parameters.AzureStorage }}
ContainerName: ${{ parameters.AzureContainerName }}
BlobPrefix: ${{ parameters.AzureUploadLocation }}
condition: ${{ parameters.condition }}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 18 (13 by maintainers)
Hi all any update on this? getting same issue
I’m running into the same issue: Breaking task version 6.240.1 6.239.x
It seems like both 240 and 239 are broken when using Az.Accounts v3.0.0