Azure-Player / azure.datafactory.tools

Tools for deploying Data Factory (v2) in Microsoft Azure
https://azureplayer.net/adftools
MIT License
207 stars 69 forks source link

Renamed objects are not deleted #359

Closed camilo-s closed 11 months ago

camilo-s commented 11 months ago

Describe the bug I'm not completely sure this is a bug but it's somehow unexpected behavior: When renaming an object (e.g. a pipeline), a new renamed object is created but the previous one is not deleted, so you end up having both the un-renamed and the renamed object in the Data Factory live mode. I think this can be handled by setting DeleteNotInSource to $true but it seems too much overhead just for a simple renaming, because you must make sure no other objects get accidentally deleted (which may be leveraging DeleteNotInSource = $false for a reason.

To Reproduce

  1. Rename an object
  2. $opt = New-AdfPublishOption
  3. $opt.DeleteNotInSource = $false
  4. $opt = New-AdfPublishOption \ $opt.Includes.Add("pipeline.Wait1", "")
  5. Publish-AdfV2FromJson -RootFolder "$RootFolder" `
       -ResourceGroupName "$ResourceGroupName" `
       -DataFactoryName "$DataFactoryName" `
       -Location "$Location" `
       -Option $opt

Expected behaviour The declared object gets renamed (i.e. deleted and a new renamed one created)

Actual behaviour The renamed object gets created, the un-renamed one persists.

Screenshots If applicable, add screenshots to help explain your problem.

Version of PowerShell module of:

Provide all files to reproduce the issue

NowinskiK commented 11 months ago

This is not a bug - it's a designed behaviour. The only way how renamed objects can be handle is by deleting the old one. To do this you must enable flag DeleteNotInSource = $true. In repo, there is no tracking information about what has been renamed.