Skip to content

Publish-AdfV2FromJson unable to delete resources on edge cases #473

@jikuja

Description

@jikuja

Describe the bug
Get-AzDatafactoryV2 Cmdlet calls might fail because Azure Management API is returning data that is not compatible with SDK being used by CmdLets. Examples here: Azure/azure-powershell#12550

Hidden error on our use case:

ExceptionDepth      : 0
Message             : Unable to deserialize the response.
ScriptStackTrace    : at Get-AdfFromService, /home/vsts/work/1/s/powershellmodules/azure.datafactory.tools/1.13.0/public/Get-AdfFromService.ps1: line 44
                      at Publish-AdfV2FromJson, /home/vsts/work/1/s/powershellmodules/azure.datafactory.tools/1.13.0/public/Publish-AdfV2FromJson.ps1: line 280
                      at <ScriptBlock>, /home/vsts/work/1/s/.azure-pipelines/Deploy.ps1: line 139
                      at <ScriptBlock>, /home/vsts/work/_temp/123f0676-be83-4bd6-830b-157d88b8d8c2.ps1: line 5
                      at <ScriptBlock>, <No file>: line 1
ExceptionType       : Microsoft.Rest.SerializationException
ExceptionStackTrace :    at Microsoft.Azure.Management.DataFactory.LinkedServicesOperations.ListByFactoryWithHttpMessagesAsync(String resourceGroupName, String factoryName, Dictionary`2 customHeaders,
                       CancellationToken cancellationToken)
                         at Microsoft.Azure.Management.DataFactory.LinkedServicesOperationsExtensions.ListByFactoryAsync(ILinkedServicesOperations operations, String resourceGroupName, String factoryN
                      ame, CancellationToken cancellationToken)
                         at Microsoft.Azure.Management.DataFactory.LinkedServicesOperationsExtensions.ListByFactory(ILinkedServicesOperations operations, String resourceGroupName, String factoryName)
                         at Microsoft.Azure.Commands.DataFactoryV2.DataFactoryClient.ListLinkedServices(AdfEntityFilterOptions filterOptions)
                         at Microsoft.Azure.Commands.DataFactoryV2.DataFactoryClient.FilterPSLinkedServices(AdfEntityFilterOptions filterOptions)
                         at Microsoft.Azure.Commands.DataFactoryV2.GetAzureDataFactoryLinkedServiceCommand.ExecuteCmdlet()
                         at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()

In this case Get-AdfFromService does not get any linked services with Get-AzDataFactoryV2LinkedService as a result Publish-AdfV2FromJson / $adfIns does not contain any linked service information and therefore linked services are not removed from service even if they should be removes

Also Publish-AdfV2FromJson print error message but does not explain where it comes and what is caused by that:

Image

To Reproduce

Linked issue has example of Amazon S3 linked service setup.

Expected behaviour

Get-AdfFromService should return all resources for further use

Version of PowerShell module of:

  • ver 1.13.0

Potential fixes

  • Maintain own version of CmdLets instead of relying on Az.Datafactory
  • Check if CmdLet errored. Is there even different signaling for Linked services not found and Cmdlet had internal issues
  • TBD

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageIssue is under investigation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions