Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure file copy fails to copy to Azure Blob #12154

Closed
trevonmckay opened this issue Jan 15, 2020 · 17 comments
Closed

Azure file copy fails to copy to Azure Blob #12154

trevonmckay opened this issue Jan 15, 2020 · 17 comments

Comments

@trevonmckay
Copy link

trevonmckay commented Jan 15, 2020

Note

Issues in this repo are for tracking bugs, feature requests and questions for the tasks in this repo

For a list:
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

If you have an issue or request for the Azure Pipelines service, use developer community instead:

https://developercommunity.visualstudio.com/spaces/21/index.html )

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Bug

Enter Task Name: Azure file copy

Environment

  • Server - Azure Pipelines

  • Account name - dalgs

  • Team project name - Digital Workplace

  • Release definition - directory-webapp-release/202001.5

  • Agent - Hosted windows-2019

Issue Description

image

Task logs

ReleaseLogs_561.zip

Troubleshooting

Checkout how to troubleshoot failures and collect debug logs: https://docs.microsoft.com/en-us/vsts/build-release/actions/troubleshooting

Error logs

2020-01-15T16:49:40.7822699Z ##[debug][Azure Call]Getting resource details for azure storage account resource: dgsappdirectoryint with resource type: Microsoft.Storage/storageAccounts 2020-01-15T16:49:42.1074825Z ##[debug]System.NullReferenceException: Object reference not set to an instance of an object. 2020-01-15T16:49:42.1096413Z ##[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-01-15T16:49:42.1111457Z ##[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-01-15T16:49:42.1132108Z ##[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-01-15T16:49:42.1146318Z ##[debug] at Microsoft.WindowsAzure.Commands.Utilities.Common.GeneralUtilities.ForEach[T](IEnumerable1 sequence, Action1 action) in d:\workspace\powershell-sign\src\Common\Commands.Common\GeneralUtilities.cs:line 147 2020-01-15T16:49:42.1167097Z ##[debug] at Microsoft.Azure.Commands.Management.Storage.StorageAccountBaseCmdlet.WriteStorageAccountList(IEnumerable1 storageAccounts) in d:\workspace\powershell-sign\src\ResourceManager\Storage\Commands.Management.Storage\StorageAccount\StorageAccountBaseCmdlet.cs:line 161
2020-01-15T16:49:42.1180004Z ##[debug] at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() in d:\workspace\powershell-sign\src\Common\Commands.Common\AzurePSCmdlet.cs:line 610
2020-01-15T16:49:42.3306724Z ##[debug]Processed: ##vso[task.logissue type=error;code={"Task_Internal_Error":"TemporaryCopyingToBlobContainerFailed"};]
2020-01-15T16:49:42.3351803Z ##[debug]Trying to disconnect from Azure and clear context at process scope
2020-01-15T16:49:42.5623196Z ##[debug]Caught exception from task script.
2020-01-15T16:49:42.5655643Z ##[debug]Error record:
2020-01-15T16:49:42.6254818Z ##[debug]Get-AzureRmStorageAccount : Object reference not set to an instance of an object.
2020-01-15T16:49:42.6267065Z ##[debug]At D:\a_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.16\AzureUtilityGTE1.0.ps1:27 char:47
2020-01-15T16:49:42.6279224Z ##[debug]+ ... ResourceDetails = Get-AzureRmStorageAccount -ErrorAction Stop | Where ...
2020-01-15T16:49:42.6290268Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-01-15T16:49:42.6303078Z ##[debug] + CategoryInfo : CloseError: (:) [Get-AzureRmStorageAccount], NullReferenceException
2020-01-15T16:49:42.6314916Z ##[debug] + FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand
2020-01-15T16:49:42.6326337Z ##[debug]
2020-01-15T16:49:42.6345394Z ##[debug]Script stack trace:
2020-01-15T16:49:42.6379888Z ##[debug]at Get-AzureStorageAccountResourceGroupName, D:\a_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.16\AzureUtilityGTE1.0.ps1: line 27
2020-01-15T16:49:42.6392058Z ##[debug]at Get-AzureStorageKeyFromARM, D:\a_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.16\AzureUtilityRest.ps1: line 28
2020-01-15T16:49:42.6406408Z ##[debug]at Get-StorageKey, D:\a_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.16\Utility.ps1: line 149
2020-01-15T16:49:42.6422458Z ##[debug]at , D:\a_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.16\AzureFileCopy.ps1: line 101
2020-01-15T16:49:42.6434089Z ##[debug]at , : line 1
2020-01-15T16:49:42.6446172Z ##[debug]at , : line 22
2020-01-15T16:49:42.6459269Z ##[debug]at , : line 18
2020-01-15T16:49:42.6470994Z ##[debug]at , : line 1
2020-01-15T16:49:42.6489785Z ##[debug]Exception:
2020-01-15T16:49:42.6511296Z ##[debug]System.NullReferenceException: Object reference not set to an instance of an object.
2020-01-15T16:49:42.6523029Z ##[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-01-15T16:49:42.6535296Z ##[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-01-15T16:49:42.6547081Z ##[debug] at Microsoft.Azure.Commands.Management.Storage.StorageAccountBaseCmdlet.<>c__DisplayClass2.b__1(StorageAccount storageAccount) in d:\workspace\powershell-sign\src\ResourceManager\Storage\Commands.Management.Storage\StorageAccount\StorageAccountBaseCmdlet.cs:line 161
2020-01-15T16:49:42.6558457Z ##[debug] at Microsoft.WindowsAzure.Commands.Utilities.Common.GeneralUtilities.ForEach[T](IEnumerable1 sequence, Action1 action) in d:\workspace\powershell-sign\src\Common\Commands.Common\GeneralUtilities.cs:line 147
2020-01-15T16:49:42.6569978Z ##[debug] at Microsoft.Azure.Commands.Management.Storage.StorageAccountBaseCmdlet.WriteStorageAccountList(IEnumerable1 storageAccounts) in d:\workspace\powershell-sign\src\ResourceManager\Storage\Commands.Management.Storage\StorageAccount\StorageAccountBaseCmdlet.cs:line 161 2020-01-15T16:49:42.6581642Z ##[debug] at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() in d:\workspace\powershell-sign\src\Common\Commands.Common\AzurePSCmdlet.cs:line 610 2020-01-15T16:49:42.6641627Z ##[error]Object reference not set to an instance of an object. 2020-01-15T16:49:42.6642015Z ##[debug]Processed: ##vso[task.logissue type=error]Object reference not set to an instance of an object.

@arjgupta
Copy link
Member

@trevonmckay can you try to execute the task on the Hosted VS2017 image and see if you are facing the same issue.

@kevbite
Copy link

kevbite commented Feb 4, 2020

I'm getting the same issue, this was running fine before, but recently has started to fail.
I've tried with vs2017-win2016 image and windows-2019 image but both result in the same error.

Logs are follows:

2020-02-04T13:36:44.3836066Z ##[debug]Installed Azure PowerShell version: 2.1.0
2020-02-04T13:36:44.3848239Z ##[debug]Compare azure versions: 2.1.0, 0.9.0
2020-02-04T13:36:44.3875666Z ##[debug]Validated the required azure powershell version is greater than or equal to 0.9.0
2020-02-04T13:36:44.3960048Z ##[debug][Azure Call]Getting resource details for azure storage account resource: portalwebdev284ee221 with resource type: Microsoft.Storage/storageAccounts
2020-02-04T13:36:45.0620908Z ##[debug]System.NullReferenceException: Object reference not set to an instance of an object.
2020-02-04T13:36:45.0633841Z ##[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:36:45.0647495Z ##[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:36:45.0660702Z ##[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:36:45.0673969Z ##[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:36:45.0687689Z ##[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:36:45.0700641Z ##[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:36:45.2090205Z ##[debug]Processed: ##vso[task.logissue type=error;code={"Task_Internal_Error":"TemporaryCopyingToBlobContainerFailed"};]
2020-02-04T13:36:45.2129497Z ##[debug]Trying to disconnect from Azure and clear context at process scope
2020-02-04T13:36:45.3926969Z ##[debug]Caught exception from task script.
2020-02-04T13:36:45.3978429Z ##[debug]Error record:
2020-02-04T13:36:45.4621514Z ##[debug]Get-AzureRmStorageAccount : Object reference not set to an instance of an object.
2020-02-04T13:36:45.4635018Z ##[debug]At D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\AzureUtilityGTE1.0.ps1:27 char:47
2020-02-04T13:36:45.4649783Z ##[debug]+ ... ResourceDetails = Get-AzureRmStorageAccount -ErrorAction Stop | Where ...
2020-02-04T13:36:45.4664437Z ##[debug]+                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-02-04T13:36:45.4677929Z ##[debug]    + CategoryInfo          : CloseError: (:) [Get-AzureRmStorageAccount], NullReferenceException
2020-02-04T13:36:45.4691726Z ##[debug]    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand
2020-02-04T13:36:45.4707083Z ##[debug] 
2020-02-04T13:36:45.4729712Z ##[debug]Script stack trace:
2020-02-04T13:36:45.4769602Z ##[debug]at Get-AzureStorageAccountResourceGroupName, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\AzureUtilityGTE1.0.ps1: line 27
2020-02-04T13:36:45.4783634Z ##[debug]at Get-AzureStorageKeyFromARM, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\AzureUtilityRest.ps1: line 28
2020-02-04T13:36:45.4795927Z ##[debug]at Get-StorageKey, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\Utility.ps1: line 149
2020-02-04T13:36:45.4808671Z ##[debug]at <ScriptBlock>, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\AzureFileCopy.ps1: line 101
2020-02-04T13:36:45.4821945Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-02-04T13:36:45.4835135Z ##[debug]at <ScriptBlock>, <No file>: line 22
2020-02-04T13:36:45.4848213Z ##[debug]at <ScriptBlock>, <No file>: line 18
2020-02-04T13:36:45.4862521Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-02-04T13:36:45.4884188Z ##[debug]Exception:
2020-02-04T13:36:45.4906758Z ##[debug]System.NullReferenceException: Object reference not set to an instance of an object.
2020-02-04T13:36:45.4920646Z ##[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:36:45.4933710Z ##[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:36:45.4947107Z ##[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:36:45.4961883Z ##[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:36:45.4974461Z ##[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:36:45.4987343Z ##[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:36:45.5049193Z ##[error]Object reference not set to an instance of an object.
2020-02-04T13:36:45.5049569Z ##[debug]Processed: ##vso[task.logissue type=error]Object reference not set to an instance of an object.
2020-02-04T13:36:45.5056946Z ##[debug]Processed: ##vso[task.complete result=Failed]
2020-02-04T13:36:45.5531901Z ##[section]Finishing: AzureBlob File Copy

@trevonmckay
Copy link
Author

@arjgupta received the same error on VS2017

@chperich
Copy link
Contributor

@trevonmckay: Thanks for reporting this issue. We have heard similar issues from other customers as well. There seems to be compat break involving AzureRM 2.1.0 module. While we will work on fixing this, it might take a while before the fix is rolled out.

As a work around, can you please add a task before file copy task. Add a script in that task to prepend env:psmodulepath with the latest AzureRM module available on the machine?

@kevbite
Copy link

kevbite commented Feb 14, 2020

I've just tried this with my instance and it seems to now be getting another error

2020-02-14T12:01:15.0627449Z ##[debug]Installed Azure PowerShell version: 2.1.0 6.13.1
2020-02-14T12:01:15.0666817Z ##[debug]Compare azure versions: 2.1.0 6.13.1, 0.9.0
2020-02-14T12:01:15.0696907Z ##[debug]Validated the required azure powershell version is greater than or equal to 0.9.0
2020-02-14T12:01:15.0814780Z ##[debug][Azure Call]Getting resource details for azure storage account resource: portalwebdev284ee221 with resource type: Microsoft.Storage/storageAccounts
2020-02-14T12:01:15.3801987Z ##[debug]Microsoft.Rest.SerializationException: Unable to deserialize the response. ---> Newtonsoft.Json.JsonSerializationException: Error converting value "Standard_GZRS" to type 'Microsoft.Azure.Management.Storage.Models.SkuName'. Path 'name', line 1, position 2604. ---> System.ArgumentException: Requested value 'Standard_GZRS' was not found.
2020-02-14T12:01:15.3814309Z ##[debug]   at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
2020-02-14T12:01:15.3829349Z ##[debug]   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
2020-02-14T12:01:15.3843093Z ##[debug]   at Newtonsoft.Json.Utilities.EnumUtils.ParseEnumName(String enumText, Boolean isNullable, Type t)
2020-02-14T12:01:15.3856503Z ##[debug]   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2020-02-14T12:01:15.3869412Z ##[debug]   --- End of inner exception stack trace ---
2020-02-14T12:01:15.3883220Z ##[debug]   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2020-02-14T12:01:15.3897795Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
2020-02-14T12:01:15.3911058Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
2020-02-14T12:01:15.3923853Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
2020-02-14T12:01:15.3936057Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2020-02-14T12:01:15.3949226Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2020-02-14T12:01:15.3962653Z ##[debug]   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
2020-02-14T12:01:15.3975363Z ##[debug]   at Microsoft.Rest.Serialization.TransformationJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2020-02-14T12:01:15.3989492Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
2020-02-14T12:01:15.4003644Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
2020-02-14T12:01:15.4016320Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
2020-02-14T12:01:15.4029642Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
2020-02-14T12:01:15.4042244Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
2020-02-14T12:01:15.4055154Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2020-02-14T12:01:15.4068239Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2020-02-14T12:01:15.4082273Z ##[debug]   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
2020-02-14T12:01:15.4094140Z ##[debug]   at Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject[T](String json, JsonSerializerSettings settings)
2020-02-14T12:01:15.4105863Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<ListWithHttpMessagesAsync>d__10.MoveNext()
2020-02-14T12:01:15.4119063Z ##[debug]   --- End of inner exception stack trace ---
2020-02-14T12:01:15.4132202Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<ListWithHttpMessagesAsync>d__10.MoveNext()
2020-02-14T12:01:15.4146249Z ##[debug]--- End of stack trace from previous location where exception was thrown ---
2020-02-14T12:01:15.4158708Z ##[debug]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2020-02-14T12:01:15.4170267Z ##[debug]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020-02-14T12:01:15.4182163Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.<ListAsync>d__11.MoveNext()
2020-02-14T12:01:15.4195080Z ##[debug]--- End of stack trace from previous location where exception was thrown ---
2020-02-14T12:01:15.4206785Z ##[debug]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2020-02-14T12:01:15.4218647Z ##[debug]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020-02-14T12:01:15.4230351Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.List(IStorageAccountsOperations operations)
2020-02-14T12:01:15.4242104Z ##[debug]   at Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand.ExecuteCmdlet()
2020-02-14T12:01:15.4254782Z ##[debug]   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
2020-02-14T12:01:15.4461152Z ##[debug]Processed: ##vso[task.logissue type=error;code={"Task_Internal_Error":"TemporaryCopyingToBlobContainerFailed"};]
2020-02-14T12:01:15.4461525Z ##[debug]Trying to disconnect from Azure and clear context at process scope
2020-02-14T12:01:15.4735940Z ##[command]Disconnect-AzureRmAccount -Scope Process -ErrorAction Stop
2020-02-14T12:01:16.1054583Z ##[command]Clear-AzureRmContext -Scope Process -ErrorAction Stop
2020-02-14T12:01:16.5242588Z ##[debug]Caught exception from task script.
2020-02-14T12:01:16.5283667Z ##[debug]Error record:
2020-02-14T12:01:16.5828703Z ##[debug]Get-AzureRmStorageAccount : Unable to deserialize the response.
2020-02-14T12:01:16.5840855Z ##[debug]At D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\AzureUtilityGTE1.0.ps1:27 char:47
2020-02-14T12:01:16.5853193Z ##[debug]+ ... ResourceDetails = Get-AzureRmStorageAccount -ErrorAction Stop | Where ...
2020-02-14T12:01:16.5869065Z ##[debug]+                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-02-14T12:01:16.5884216Z ##[debug]    + CategoryInfo          : CloseError: (:) [Get-AzureRmStorageAccount], SerializationException
2020-02-14T12:01:16.5899415Z ##[debug]    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand
2020-02-14T12:01:16.5921668Z ##[debug] 
2020-02-14T12:01:16.5939713Z ##[debug]Script stack trace:
2020-02-14T12:01:16.5980259Z ##[debug]at Get-AzureStorageAccountResourceGroupName, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\AzureUtilityGTE1.0.ps1: line 27
2020-02-14T12:01:16.5992230Z ##[debug]at Get-AzureStorageKeyFromARM, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\AzureUtilityRest.ps1: line 28
2020-02-14T12:01:16.6004775Z ##[debug]at Get-StorageKey, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\Utility.ps1: line 149
2020-02-14T12:01:16.6018381Z ##[debug]at <ScriptBlock>, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\2.154.19\AzureFileCopy.ps1: line 101
2020-02-14T12:01:16.6029888Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-02-14T12:01:16.6042476Z ##[debug]at <ScriptBlock>, <No file>: line 22
2020-02-14T12:01:16.6054599Z ##[debug]at <ScriptBlock>, <No file>: line 18
2020-02-14T12:01:16.6066765Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-02-14T12:01:16.6083680Z ##[debug]Exception:
2020-02-14T12:01:16.6105770Z ##[debug]Microsoft.Rest.SerializationException: Unable to deserialize the response. ---> Newtonsoft.Json.JsonSerializationException: Error converting value "Standard_GZRS" to type 'Microsoft.Azure.Management.Storage.Models.SkuName'. Path 'name', line 1, position 2604. ---> System.ArgumentException: Requested value 'Standard_GZRS' was not found.
2020-02-14T12:01:16.6118746Z ##[debug]   at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
2020-02-14T12:01:16.6130416Z ##[debug]   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
2020-02-14T12:01:16.6143232Z ##[debug]   at Newtonsoft.Json.Utilities.EnumUtils.ParseEnumName(String enumText, Boolean isNullable, Type t)
2020-02-14T12:01:16.6156440Z ##[debug]   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2020-02-14T12:01:16.6169462Z ##[debug]   --- End of inner exception stack trace ---
2020-02-14T12:01:16.6184788Z ##[debug]   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2020-02-14T12:01:16.6203181Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
2020-02-14T12:01:16.6217590Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
2020-02-14T12:01:16.6230112Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
2020-02-14T12:01:16.6242060Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2020-02-14T12:01:16.6253458Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2020-02-14T12:01:16.6267942Z ##[debug]   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
2020-02-14T12:01:16.6280129Z ##[debug]   at Microsoft.Rest.Serialization.TransformationJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2020-02-14T12:01:16.6291368Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
2020-02-14T12:01:16.6302899Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
2020-02-14T12:01:16.6317317Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
2020-02-14T12:01:16.6331667Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
2020-02-14T12:01:16.6344584Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
2020-02-14T12:01:16.6357493Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2020-02-14T12:01:16.6370000Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2020-02-14T12:01:16.6382174Z ##[debug]   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
2020-02-14T12:01:16.6394928Z ##[debug]   at Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject[T](String json, JsonSerializerSettings settings)
2020-02-14T12:01:16.6408259Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<ListWithHttpMessagesAsync>d__10.MoveNext()
2020-02-14T12:01:16.6420400Z ##[debug]   --- End of inner exception stack trace ---
2020-02-14T12:01:16.6435527Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<ListWithHttpMessagesAsync>d__10.MoveNext()
2020-02-14T12:01:16.6449604Z ##[debug]--- End of stack trace from previous location where exception was thrown ---
2020-02-14T12:01:16.6462400Z ##[debug]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2020-02-14T12:01:16.6476861Z ##[debug]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020-02-14T12:01:16.6496093Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.<ListAsync>d__11.MoveNext()
2020-02-14T12:01:16.6510047Z ##[debug]--- End of stack trace from previous location where exception was thrown ---
2020-02-14T12:01:16.6521753Z ##[debug]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2020-02-14T12:01:16.6534165Z ##[debug]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020-02-14T12:01:16.6547988Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.List(IStorageAccountsOperations operations)
2020-02-14T12:01:16.6560162Z ##[debug]   at Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand.ExecuteCmdlet()
2020-02-14T12:01:16.6573031Z ##[debug]   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
2020-02-14T12:01:16.6747077Z ##[error]Unable to deserialize the response.
2020-02-14T12:01:16.6747390Z ##[debug]Processed: ##vso[task.logissue type=error]Unable to deserialize the response.
2020-02-14T12:01:16.6764783Z ##[debug]Processed: ##vso[task.complete result=Failed]
2020-02-14T12:01:16.7213925Z ##[section]Finishing: AzureBlob File Copy

@kevbite
Copy link

kevbite commented Feb 14, 2020

Been trying today to get the Azure file copy task working, tried loads of options and installing different versions of the Azure PowerShell modules but just lots of errors.

I decided to give up and write the PowerShell myself to just copy the files 👍.

The workaround for me was to just add a Azure PowerShell task and use the following inline script:

$StorageAcountObj = Get-AzStorageAccount -ResourceGroupName $(ResourceGroup) -Name $(StorageAccountName);
$StorageContext = $StorageAcountObj.Context

Get-ChildItem "$(System.DefaultWorkingDirectory)/where-your-files-are" -File -Recurse | Set-AzStorageBlobContent -Context $StorageContext -Container "`$web" -Force

Then just set the ResourceGroup and StorageAccountName in your pipeline variables

@kevbite
Copy link

kevbite commented Feb 17, 2020

Bit of an update as the above script uploaded the files but some were the incorrect content type and if you're using Blob storage to host a static website then Chrome doesn't like been given the incorrect data type.
I've recently updated my own script to be the following

Add-Type -AssemblyName "System.Web"
$StorageAcountObj = Get-AzStorageAccount -ResourceGroupName $(ResourceGroup) -Name $(StorageAccountName);
$StorageContext = $StorageAcountObj.Context
$items = Get-ChildItem "$(System.DefaultWorkingDirectory)/where-your-files-are" -File -Recurse
foreach ($item in $items) {
  $mineType = [System.Web.MimeMapping]::GetMimeMapping($item.FullName)
  Write-Host "Uploading $($item.FullName) $($mineType)"
  Set-AzStorageBlobContent -Context $StorageContext -File $item.FullName -Container "`$web" -Force -Properties @{"ContentType" = $mineType}
}

Just thought I'd share for anyone else with similar problems and needing a workaround 👍

@20shivangi
Copy link
Contributor

@trevonmckay We have fixed the issue in latest version of AzureFileCopy. It will take at least 5-6 weeks to get deployed.

@20shivangi
Copy link
Contributor

Closing this issue as the fix has been rolled out which will be deployed in 4-5 weeks.

@chandlerkent
Copy link
Contributor

chandlerkent commented Jul 1, 2020

@20shivangi we are having this issue starting today. I have tried it with V2, V3, and V4 of the task and they all fail. I have tried it on the vs2017-win2016 and windows-2019 Hosted Agents and they also both fail. Logs below:

2020-07-01T20:01:29.9742829Z ##[debug]Validating installed azure powershell version is greater than or equal to AzureRM 1.1.0
2020-07-01T20:01:30.0544450Z ##[debug]Cannot verify the Microsoft .NET Framework version 4.5.2 because it is not included in the list of permitted versions.
2020-07-01T20:01:30.0669147Z ##[debug]Populating RepositorySourceLocation property for module AzureRM.
2020-07-01T20:01:30.0716054Z ##[debug]Loading module from path 'C:\modules\azurerm_6.13.1\AzureRM\6.13.1\AzureRM.psm1'.
2020-07-01T20:01:30.0880493Z ##[debug]Populating RepositorySourceLocation property for module AzureRM.
2020-07-01T20:01:30.0943026Z ##[debug]Loading module from path 'C:\Modules\azurerm_2.1.0\AzureRM\2.1.0\AzureRM.psm1'.
2020-07-01T20:01:30.1323515Z ##[debug]Installed Azure PowerShell version: 6.13.1 2.1.0
2020-07-01T20:01:30.1437190Z ##[debug]Compare azure versions: 6.13.1 2.1.0, 1.1.0
2020-07-01T20:01:30.1610358Z ##[debug]Validated the required azure powershell version is greater than or equal to 1.1.0
2020-07-01T20:01:30.1742891Z ##[debug][Azure Call]Getting resource details for azure storage account resource: rc16us1staticfiles01sa with resource type: Microsoft.Storage/storageAccounts
2020-07-01T20:01:31.5523700Z ##[debug]Microsoft.Rest.SerializationException: Unable to deserialize the response. ---> Newtonsoft.Json.JsonSerializationException: Error converting value "FileStorage" to type 'System.Nullable`1[Microsoft.Azure.Management.Storage.Models.Kind]'. Path '', line 1, position 98867. ---> System.ArgumentException: Requested value 'FileStorage' was not found.
2020-07-01T20:01:31.5550800Z ##[debug]   at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
2020-07-01T20:01:31.5589750Z ##[debug]   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
2020-07-01T20:01:31.5649798Z ##[debug]   at Newtonsoft.Json.Utilities.EnumUtils.ParseEnumName(String enumText, Boolean isNullable, Type t)
2020-07-01T20:01:31.5692316Z ##[debug]   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2020-07-01T20:01:31.5720335Z ##[debug]   --- End of inner exception stack trace ---
2020-07-01T20:01:31.5743714Z ##[debug]   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2020-07-01T20:01:31.5766565Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
2020-07-01T20:01:31.5840944Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2020-07-01T20:01:31.5863132Z ##[debug]   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
2020-07-01T20:01:31.5935109Z ##[debug]   at Microsoft.Rest.Serialization.TransformationJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2020-07-01T20:01:31.5942632Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
2020-07-01T20:01:31.5965724Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
2020-07-01T20:01:31.5994967Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
2020-07-01T20:01:31.6032642Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
2020-07-01T20:01:31.6057748Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
2020-07-01T20:01:31.6082637Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2020-07-01T20:01:31.6164266Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2020-07-01T20:01:31.6216258Z ##[debug]   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
2020-07-01T20:01:31.6239030Z ##[debug]   at Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject[T](String json, JsonSerializerSettings settings)
2020-07-01T20:01:31.6265512Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<ListWithHttpMessagesAsync>d__10.MoveNext()
2020-07-01T20:01:31.6289343Z ##[debug]   --- End of inner exception stack trace ---
2020-07-01T20:01:31.6311249Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<ListWithHttpMessagesAsync>d__10.MoveNext()
2020-07-01T20:01:31.6364579Z ##[debug]--- End of stack trace from previous location where exception was thrown ---
2020-07-01T20:01:31.6398764Z ##[debug]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2020-07-01T20:01:31.6440505Z ##[debug]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020-07-01T20:01:31.6481145Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.<ListAsync>d__11.MoveNext()
2020-07-01T20:01:31.6506492Z ##[debug]--- End of stack trace from previous location where exception was thrown ---
2020-07-01T20:01:31.6529675Z ##[debug]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2020-07-01T20:01:31.6606996Z ##[debug]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020-07-01T20:01:31.6631766Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.List(IStorageAccountsOperations operations)
2020-07-01T20:01:31.6740095Z ##[debug]   at Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand.ExecuteCmdlet()
2020-07-01T20:01:31.6770413Z ##[debug]   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
2020-07-01T20:01:31.7097539Z ##[debug]Processed: ##vso[task.logissue type=error;code={"Task_Internal_Error":"TemporaryCopyingToBlobContainerFailed"};]
2020-07-01T20:01:31.7108543Z ##[debug]Trying to disconnect from Azure and clear context at process scope
2020-07-01T20:01:31.7602885Z ##[command]Disconnect-AzureRmAccount -Scope Process -ErrorAction Stop
2020-07-01T20:01:32.0066998Z ##[command]Clear-AzureRmContext -Scope Process -ErrorAction Stop
2020-07-01T20:01:32.2152092Z ##[debug]Caught exception from task script.
2020-07-01T20:01:32.2231097Z ##[debug]Error record:
2020-07-01T20:01:32.3315977Z ##[debug]Get-AzureRmStorageAccount : Unable to deserialize the response.
2020-07-01T20:01:32.3393373Z ##[debug]At D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\3.171.1\AzureUtilityARM.ps1:13 char:47
2020-07-01T20:01:32.3414054Z ##[debug]+ ... ResourceDetails = Get-AzureRmStorageAccount -ErrorAction Stop | Where ...
2020-07-01T20:01:32.3470422Z ##[debug]+                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-07-01T20:01:32.3506355Z ##[debug]    + CategoryInfo          : CloseError: (:) [Get-AzureRmStorageAccount], SerializationException
2020-07-01T20:01:32.3534773Z ##[debug]    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand
2020-07-01T20:01:32.3649864Z ##[debug] 
2020-07-01T20:01:32.3685121Z ##[debug]Script stack trace:
2020-07-01T20:01:32.3737654Z ##[debug]at Get-AzureStorageAccountResourceGroupName, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\3.171.1\AzureUtilityARM.ps1: line 13
2020-07-01T20:01:32.3767525Z ##[debug]at Get-AzureStorageKeyFromARM, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\3.171.1\AzureUtilityRest.ps1: line 11
2020-07-01T20:01:32.3796854Z ##[debug]at Get-StorageKey, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\3.171.1\Utility.ps1: line 70
2020-07-01T20:01:32.3819659Z ##[debug]at <ScriptBlock>, D:\a\_tasks\AzureFileCopy_eb72cb01-a7e5-427b-a8a1-1b31ccac8a43\3.171.1\AzureFileCopy.ps1: line 103
2020-07-01T20:01:32.3847733Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-07-01T20:01:32.3871850Z ##[debug]at <ScriptBlock>, <No file>: line 22
2020-07-01T20:01:32.3898579Z ##[debug]at <ScriptBlock>, <No file>: line 18
2020-07-01T20:01:32.3925999Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-07-01T20:01:32.3960098Z ##[debug]Exception:
2020-07-01T20:01:32.4027989Z ##[debug]Microsoft.Rest.SerializationException: Unable to deserialize the response. ---> Newtonsoft.Json.JsonSerializationException: Error converting value "FileStorage" to type 'System.Nullable`1[Microsoft.Azure.Management.Storage.Models.Kind]'. Path '', line 1, position 98867. ---> System.ArgumentException: Requested value 'FileStorage' was not found.
2020-07-01T20:01:32.4048972Z ##[debug]   at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
2020-07-01T20:01:32.4080249Z ##[debug]   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
2020-07-01T20:01:32.4127438Z ##[debug]   at Newtonsoft.Json.Utilities.EnumUtils.ParseEnumName(String enumText, Boolean isNullable, Type t)
2020-07-01T20:01:32.4152119Z ##[debug]   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2020-07-01T20:01:32.4205922Z ##[debug]   --- End of inner exception stack trace ---
2020-07-01T20:01:32.4207052Z ##[debug]   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2020-07-01T20:01:32.4218047Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
2020-07-01T20:01:32.4239497Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2020-07-01T20:01:32.4271296Z ##[debug]   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
2020-07-01T20:01:32.4318891Z ##[debug]   at Microsoft.Rest.Serialization.TransformationJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
2020-07-01T20:01:32.4341511Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
2020-07-01T20:01:32.4367756Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
2020-07-01T20:01:32.4417935Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
2020-07-01T20:01:32.4442514Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
2020-07-01T20:01:32.4473347Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
2020-07-01T20:01:32.4495244Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2020-07-01T20:01:32.4521626Z ##[debug]   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2020-07-01T20:01:32.4552558Z ##[debug]   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
2020-07-01T20:01:32.4575640Z ##[debug]   at Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject[T](String json, JsonSerializerSettings settings)
2020-07-01T20:01:32.4621678Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<ListWithHttpMessagesAsync>d__10.MoveNext()
2020-07-01T20:01:32.4646536Z ##[debug]   --- End of inner exception stack trace ---
2020-07-01T20:01:32.4711232Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperations.<ListWithHttpMessagesAsync>d__10.MoveNext()
2020-07-01T20:01:32.4719322Z ##[debug]--- End of stack trace from previous location where exception was thrown ---
2020-07-01T20:01:32.4743688Z ##[debug]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2020-07-01T20:01:32.4783266Z ##[debug]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020-07-01T20:01:32.4850707Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.<ListAsync>d__11.MoveNext()
2020-07-01T20:01:32.4879799Z ##[debug]--- End of stack trace from previous location where exception was thrown ---
2020-07-01T20:01:32.4903865Z ##[debug]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
2020-07-01T20:01:32.4935604Z ##[debug]   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020-07-01T20:01:32.4980757Z ##[debug]   at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.List(IStorageAccountsOperations operations)
2020-07-01T20:01:32.5031627Z ##[debug]   at Microsoft.Azure.Commands.Management.Storage.GetAzureStorageAccountCommand.ExecuteCmdlet()
2020-07-01T20:01:32.5066275Z ##[debug]   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
2020-07-01T20:01:32.5334714Z ##[error]Unable to deserialize the response.
2020-07-01T20:01:32.5336408Z ##[debug]Processed: ##vso[task.logissue type=error]Unable to deserialize the response.
2020-07-01T20:01:32.5370749Z ##[debug]Processed: ##vso[task.complete result=Failed]
2020-07-01T20:01:32.5990858Z ##[section]Finishing: AzureBlob File Copy

Here is the start of the task for version #s:

2020-07-01T19:59:56.0140921Z ##[section]Starting: AzureBlob File Copy
2020-07-01T19:59:56.0340733Z ==============================================================================
2020-07-01T19:59:56.0341120Z Task         : Azure file copy
2020-07-01T19:59:56.0341437Z Description  : Copy files to Azure Blob Storage or virtual machines
2020-07-01T19:59:56.0341734Z Version      : 3.171.1
2020-07-01T19:59:56.0341981Z Author       : Microsoft Corporation
2020-07-01T19:59:56.0342361Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy
2020-07-01T19:59:56.0342775Z ==============================================================================

We were using V2 and the older task version worked yesterday.

YESTERDAY (worked):

==============================================================================
2020-06-30T17:56:14.9178811Z Task         : Azure file copy
2020-06-30T17:56:14.9179300Z Description  : Copy files to Azure Blob Storage or virtual machines
2020-06-30T17:56:14.9179677Z Version      : 2.167.4
2020-06-30T17:56:14.9180010Z Author       : Microsoft Corporation
2020-06-30T17:56:14.9180485Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy
2020-06-30T17:56:14.9181015Z ==============================================================================

TODAY (broken):

==============================================================================
2020-07-01T18:32:45.9786398Z Task         : Azure file copy
2020-07-01T18:32:45.9786837Z Description  : Copy files to Azure Blob Storage or virtual machines
2020-07-01T18:32:45.9787223Z Version      : 2.171.1
2020-07-01T18:32:45.9787567Z Author       : Microsoft Corporation
2020-07-01T18:32:45.9788054Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy
2020-07-01T18:32:45.9788589Z ==============================================================================

Also note that based on the diffs of the task, I think the issue is likely caused by using a new version of AzureRM through this commit:

9c1e149#diff-10c0386b7ba2862cd7e655dfcf5dbb96

Based on the logs, it previously imported AzureRM 2.1.0 and it is now using AzureRM 6.13.1

@asranja
Copy link
Contributor

asranja commented Jul 2, 2020

@chandlerkent I tried to revert the change and test it using 2.1.0 module. The task failed even with 2.1.0 version of the module. Can you confirm that you were using storage account of type Premium File Storage and were able to execute the task successfully with versions V2 and V3 ?

@chandlerkent
Copy link
Contributor

chandlerkent commented Jul 2, 2020

@asranja Thank you for taking a look. We were previously using the V2 task and have been successfully for many months without any changes to the storage account (it is part of a pipeline that runs each day). In fact, we are still using V2 only because that was the latest version that was out when the pipeline was created.

I don't believe we are using a Premium File Storage account. The SKU is "StorageV2 (general purpose v2)".

We were not using the V3 version of the task so I do not know if it used to work. I do know that V3 did not work as we tried upgrading to it after V2 stopped working yesterday.

Is there anything we can do temporarily to get our pipelines working while the bug gets investigated or do we need to wait for a fix to the task? I don't think there is a way for us to use the older version of the task, is there?

@asranja
Copy link
Contributor

asranja commented Jul 2, 2020

@chandlerkent Can you point out the error you got with Azure File Copy V4 task ?

@chandlerkent
Copy link
Contributor

@asranja V4 task gives us a permissions error.

Task info:

2020-07-01T19:47:47.3245488Z ##[section]Starting: AzureBlob File Copy
2020-07-01T19:47:47.3476646Z ==============================================================================
2020-07-01T19:47:47.3477032Z Task         : Azure file copy
2020-07-01T19:47:47.3477332Z Description  : Copy files to Azure Blob Storage or virtual machines
2020-07-01T19:47:47.3479945Z Version      : 4.171.1
2020-07-01T19:47:47.3480715Z Author       : Microsoft Corporation
2020-07-01T19:47:47.3481081Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-file-copy
2020-07-01T19:47:47.3482569Z ==============================================================================

Error:

2020-07-01T19:49:18.7842490Z ##[command] & "AzCopy\AzCopy.exe" login --service-principal --application-id "***" --tenant-id="***" --aad-endpoint "https://login.windows.net/"
2020-07-01T19:49:18.8618579Z INFO: If you set an environment variable by using the command line, that variable will be readable in your command line history. Consider clearing variables that contain credentials from your command line history.  To keep variables from appearing in your history, you can use a script to prompt the user for their credentials, and to set the environment variable.
2020-07-01T19:49:19.0259381Z INFO: SPN Auth via secret succeeded.
2020-07-01T19:49:19.4816592Z INFO: AzCopy.exe: A newer version 10.4.3 is available to download
2020-07-01T19:49:19.4817078Z 
2020-07-01T19:49:19.5318005Z INFO: AzCopy.exe: A newer version 10.4.3 is available to download
2020-07-01T19:49:19.5318395Z 
2020-07-01T19:49:19.5427716Z Uploading files from source path: '\redacted\path' to storage account: 'REDACTED' in container: '$web' with blob prefix: 'assets'
2020-07-01T19:49:19.5602569Z ##[command] & "AzCopy\AzCopy.exe" copy "\redacted\path" "https://REDACTED.blob.core.windows.net/`$web/assets"  --log-level=INFO --recursive
2020-07-01T19:49:19.5977532Z INFO: Scanning...
2020-07-01T19:49:19.5980097Z INFO: Using OAuth token for authentication.
2020-07-01T19:49:20.2474908Z INFO: AzCopy.exe: A newer version 10.4.3 is available to download
2020-07-01T19:49:20.2475680Z 
2020-07-01T19:49:20.3514696Z 
2020-07-01T19:49:20.3518210Z Job 9b4452d9-ad0a-1f43-50c9-1de1ca729b65 has started
2020-07-01T19:49:20.3522873Z Log file is located at: C:\Users\VssAdministrator\.azcopy\9b4452d9-ad0a-1f43-50c9-1de1ca729b65.log
2020-07-01T19:49:20.3524261Z 
2020-07-01T19:49:20.3528335Z 
2020-07-01T19:49:20.7319464Z 0.0 %, 0 Done, 0 Failed, 1014 Pending, 0 Skipped, 1014 Total, 
2020-07-01T19:49:20.7324727Z INFO: Authentication failed, it is either not correct, or expired, or does not have the correct permission -> github.com/Azure/azure-storage-blob-go/azblob.newStorageError, /home/vsts/go/pkg/mod/github.com/!azure/azure-storage-blob-go@v0.7.0/azblob/zc_storage_error.go:42
2020-07-01T19:49:20.7348752Z ===== RESPONSE ERROR (ServiceCode=AuthorizationPermissionMismatch) =====
2020-07-01T19:49:20.7354238Z Description=This request is not authorized to perform this operation using this permission.
2020-07-01T19:49:20.7382481Z RequestId:08ceee28-f01e-0065-3fe0-4f55b9000000
2020-07-01T19:49:20.7409906Z Time:2020-07-01T19:49:20.7228017Z, Details: 
2020-07-01T19:49:20.7467749Z    Code: AuthorizationPermissionMismatch
2020-07-01T19:49:20.7507691Z    PUT https://REDACTED.blob.core.windows.net/$web/assets/REDACTED?timeout=901
2020-07-01T19:49:20.7511298Z    Authorization: REDACTED
2020-07-01T19:49:20.7518713Z    Content-Length: [0]
2020-07-01T19:49:20.7523284Z    User-Agent: [TFS_useragent AzCopy/10.3.3 Azure-Storage/0.7 (go1.13; Windows_NT)]
2020-07-01T19:49:20.7524220Z    X-Ms-Blob-Cache-Control: []
2020-07-01T19:49:20.7532186Z    X-Ms-Blob-Content-Disposition: []
2020-07-01T19:49:20.7534569Z    X-Ms-Blob-Content-Encoding: []
2020-07-01T19:49:20.7535358Z    X-Ms-Blob-Content-Language: []
2020-07-01T19:49:20.7535862Z    X-Ms-Blob-Content-Type: []
2020-07-01T19:49:20.7536281Z    X-Ms-Blob-Type: [BlockBlob]
2020-07-01T19:49:20.7536768Z    X-Ms-Client-Request-Id: [e22f120c-2f09-4504-7d00-f83137101df7]
2020-07-01T19:49:20.7537215Z    X-Ms-Version: [2018-03-28]
2020-07-01T19:49:20.7537720Z    --------------------------------------------------------------------------------
2020-07-01T19:49:20.7538454Z    RESPONSE Status: 403 This request is not authorized to perform this operation using this permission.
2020-07-01T19:49:20.7539043Z    Content-Length: [279]
2020-07-01T19:49:20.7539444Z    Content-Type: [application/xml]
2020-07-01T19:49:20.7540263Z    Date: [Wed, 01 Jul 2020 19:49:19 GMT]
2020-07-01T19:49:20.7540820Z    Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0]
2020-07-01T19:49:20.7541338Z    X-Ms-Error-Code: [AuthorizationPermissionMismatch]
2020-07-01T19:49:20.7541829Z    X-Ms-Request-Id: [08ceee28-f01e-0065-3fe0-4f55b9000000]
2020-07-01T19:49:20.7542285Z    X-Ms-Version: [2018-03-28]
2020-07-01T19:49:20.7542554Z 
2020-07-01T19:49:20.7542761Z 
2020-07-01T19:49:20.7542946Z 
2020-07-01T19:49:22.3531929Z 0.0 %, 0 Done, 0 Failed, 1014 Pending, 0 Skipped, 1014 Total, 
2020-07-01T19:49:22.3532923Z 
2020-07-01T19:49:22.3534597Z 
2020-07-01T19:49:22.3539972Z Job 9b4452d9-ad0a-1f43-50c9-1de1ca729b65 summary
2020-07-01T19:49:22.3546110Z Elapsed Time (Minutes): 0.0333
2020-07-01T19:49:22.3546699Z Total Number Of Transfers: 1014
2020-07-01T19:49:22.3554449Z Number of Transfers Completed: 0
2020-07-01T19:49:22.3558824Z Number of Transfers Failed: 1
2020-07-01T19:49:22.3563558Z Number of Transfers Skipped: 0
2020-07-01T19:49:22.3567562Z TotalBytesTransferred: 0
2020-07-01T19:49:22.3571636Z Final Job Status: Cancelled
2020-07-01T19:49:22.3573335Z 
2020-07-01T19:49:22.4212169Z ##[debug]ExceptionMessage: AzCopy.exe exited with non-zero exit code while uploading files to blob storage.
2020-07-01T19:49:22.9321246Z ##[debug]Processed: ##vso[task.logissue type=error;code={"Task_Internal_Error":"BlobUploadFailed"};]
2020-07-01T19:49:22.9595437Z ##[command] & "AzCopy\A

The Service Principal is actually an owner of the entire subscription with no deny statements on this Storage Account.

@asranja
Copy link
Contributor

asranja commented Jul 2, 2020

Yes, this was a breaking change with Azure File Copy V4 (hence a new version).

The Service Principal needs to also have Storage Blob Data Contributor permissions on the Storage account. This is because of AzCopy.exe logging in using the Service Principal Credentials in V4 task. Can you assign the permission and re-queue the pipeline. More details on Azure File Copy V4 task and roles.

AzureFileCopyV4 task is based on new Az modules as opposed to older AzureRm modules. V4 is the way going forward. That being said, we are working on finding the root cause in V2 and V3, and will come with a fix asap.

@chandlerkent
Copy link
Contributor

@asranja Ah OK, thank you! I will try that and let you know!

@chandlerkent
Copy link
Contributor

@asranja Just to follow up that did fix the issue and the V4 task is now working after I gave the Service Principal the correct permissions on the Storage Account. Thank you!

If you need any tests of the V2/V3 tasks, I would still be happy to test those and verify they will fix the reported issue.

Thank you again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants