Salesforce connection - copy task - "Read behavior" setting parametrized causes "Unable to deserialize the response"
When cleanup parameter is set in the deploy and deploy goes into the cleanup step, it executes: Get-AzDataFactoryV2Pipeline -ResourceGroupName "$ResourceGroupName" -DataFactoryName "$FactoryName" | ToArray This fails in case one of the pipelines has a copy task based on a Salesforce connection, where the "Read behavior" setting is parametrized. I think it might be because of an older Az.Datafactory module used in the code, because when I run the Get-AzDataFactoryV2Pipeline from Azure cloud shell it is working.
Debug trace:
STEP: Deleting objects not in source ...
Azure Data Factory (instance) loaded.
DataSets: 30 object(s) loaded.
IntegrationRuntimes: 4 object(s) loaded.
LinkedServices: 20 object(s) loaded.
##[debug]Agent environment resources - Disk: D:\ Available 12429.00 MB out of 14333.00 MB, Memory: Used 1994.00 MB out of 7167.00 MB, CPU: Usage 2.67%
##[debug]Leaving D:\a_tasks\PublishADFTask_1af843b5-35a0-411f-9a18-9eb7a59fb8b8\1.32.1423\PublishADF.ps1.
##[debug]Caught exception from task script.
##[debug]Error record:
##[debug]Get-AzDataFactoryV2Pipeline : Unable to deserialize the response.
##[debug]At D:\a_tasks\PublishADFTask_1af843b5-35a0-411f-9a18-9eb7a59fb8b8\1.32.1423\ps_modules\azure.datafactory.tools\public\Get-AdfFromService.ps1:46 char:22
##[debug]+ ... Pipelines = Get-AzDataFactoryV2Pipeline -ResourceGroupName "$Resource ...
##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##[debug] + CategoryInfo : CloseError: (:) [Get-AzDataFactoryV2Pipeline], SerializationException
##[debug] + FullyQualifiedErrorId : Microsoft.Azure.Commands.DataFactoryV2.GetAzureDataFactoryPipelineCommand
##[debug]
##[debug]Script stack trace:
##[debug]at Get-AdfFromService, D:\a_tasks\PublishADFTask_1af843b5-35a0-411f-9a18-9eb7a59fb8b8\1.32.1423\ps_modules\azure.datafactory.tools\public\Get-AdfFromService.ps1: line 46
##[debug]at Publish-AdfV2FromJson, D:\a_tasks\PublishADFTask_1af843b5-35a0-411f-9a18-9eb7a59fb8b8\1.32.1423\ps_modules\azure.datafactory.tools\public\Publish-AdfV2FromJson.ps1: line 274
##[debug]at <ScriptBlock>, D:\a_tasks\PublishADFTask_1af843b5-35a0-411f-9a18-9eb7a59fb8b8\1.32.1423\PublishADF.ps1: line 137
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]at <ScriptBlock>, <No file>: line 22
##[debug]at <ScriptBlock>, <No file>: line 18
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]Exception:
##[debug]Microsoft.Rest.SerializationException: Unable to deserialize the response. ---> Newtonsoft.Json.JsonReaderException: Error reading string. Unexpected token: StartObject. Path 'readBehavior', line 13506, position 33.
##[debug] at Newtonsoft.Json.JsonReader.ReadAsString()
##[debug] at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
##[debug] at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
##[debug] at Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) ##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue) ##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) ##[debug] at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer) ##[debug] at Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
##[debug] at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
##[debug] at Microsoft.Rest.Serialization.TransformationJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
##[debug] at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
##[debug] at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
##[debug] at Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject[T](String json, JsonSerializerSettings settings)
##[debug] at Microsoft.Azure.Management.DataFactory.PipelinesOperations.<ListByFactoryWithHttpMessagesAsync>d__5.MoveNext()
##[debug] --- End of inner exception stack trace ---
##[debug] at Microsoft.Azure.Management.DataFactory.PipelinesOperations.<ListByFactoryWithHttpMessagesAsync>d__5.MoveNext()
##[debug]--- End of stack trace from previous location where exception was thrown ---
##[debug] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
##[debug] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
##[debug] at Microsoft.Azure.Management.DataFactory.PipelinesOperationsExtensions.<ListByFactoryAsync>d__1.MoveNext()
##[debug]--- End of stack trace from previous location where exception was thrown ---
##[debug] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
##[debug] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
##[debug] at Microsoft.Azure.Management.DataFactory.PipelinesOperationsExtensions.ListByFactory(IPipelinesOperations operations, String resourceGroupName, String factoryName)
##[debug] at Microsoft.Azure.Commands.DataFactoryV2.DataFactoryClient.ListPipelines(AdfEntityFilterOptions filterOptions)
##[debug] at Microsoft.Azure.Commands.DataFactoryV2.DataFactoryClient.FilterPSPipelines(AdfEntityFilterOptions filterOptions)
##[debug] at Microsoft.Azure.Commands.DataFactoryV2.GetAzureDataFactoryPipelineCommand.ExecuteCmdlet()
##[debug] at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
##[error]Unable to deserialize the response.
##[debug]Processed: ##vso[task.logissue type=error]Unable to deserialize the response.
##[debug]Processed: ##vso[task.complete result=Failed]