Skip to content

Fixed #480 (preview)#489

Merged
NowinskiK merged 6 commits into
developfrom
issue-480
Jun 30, 2026
Merged

Fixed #480 (preview)#489
NowinskiK merged 6 commits into
developfrom
issue-480

Conversation

@NowinskiK

@NowinskiK NowinskiK commented May 27, 2026

Copy link
Copy Markdown
Member

Fix for Issue #480

Root cause: Get-AzDataFactoryV2Dataset (and other Get-AzDataFactoryV2* cmdlets) throw "Unable to deserialize the response" when the ADF service contains objects whose types aren't supported by the installed Az.DataFactory module version. This blocks DeleteNotInSource entirely.

Three files changed/created:

private/AdfPSObjects.class.ps1 (new)

Six lightweight wrapper classes (AdfPSDataset, AdfPSDataFlow, AdfPSPipeline, AdfPSLinkedService, AdfPSIntegrationRuntime, AdfPSTrigger) following the existing AdfPS<SimplifiedType> naming convention. Get-SimplifiedType already strips the AdfPS prefix, so these integrate with Remove-AdfObject's type switch without any changes there.

private/Get-AdfObjectsFromServiceRestAPI.ps1 (new)

A fallback function that lists ADF objects of any given type via the management REST API — same approach already used for credentials via Get-AzDFV2Credential. Returns the appropriate typed wrappers above.

public/Get-AdfFromService.ps1 (modified)

Each Get-AzDataFactoryV2* call is now wrapped in a try-catch. On failure it logs a warning and falls back to the REST API. The happy path (no deserialization issues) is completely unchanged.

@jikuja

jikuja commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

I tested this and looks like partially works. Get Get-AzDataFactoryV2* Cmdlets emit non-terminating errors and should be called with -ErrorAction Stop or $? should be tested by caller.

When adding -ErrorAction Stop on Get-AdfFromService call $ErrorActionPreference

Results:

PS /xx/azure.datafactory.tools> $foo = Get-AdfFromService -ResourceGroupName xxxx-dev-rg -FactoryName xxxxx-dev-df -ErrorAction Stop
Azure Data Factory (instance) loaded.
DataSets: 75 object(s) loaded.
IntegrationRuntimes: 1 object(s) loaded.
WARNING: Failed to list LinkedServices via Az cmdlet (possible deserialization issue). Falling back to REST API. Error: Unable to deserialize the response.
LinkedServices: 36 object(s) loaded.
Pipelines: 151 object(s) loaded.
DataFlows: 7 object(s) loaded.
Triggers: 6 object(s) loaded.
Credentials: 0 object(s) loaded.
PS /xx/azure.datafactory.tools> $foo.LinkedServices.Count                                                                                                
36

vs

$foo = Get-AdfFromService -ResourceGroupName xxxxy-dev-rg -FactoryName xxxxxx-dev-df
Azure Data Factory (instance) loaded.
DataSets: 75 object(s) loaded.
IntegrationRuntimes: 1 object(s) loaded.
Get-AzDataFactoryV2LinkedService: /root/.local/share/powershell/Modules/azure.datafactory.tools/1.16.0/public/Get-AdfFromService.ps1:55
Line |
  55 |  … dServices = Get-AzDataFactoryV2LinkedService -ResourceGroupName "$Res …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to deserialize the response.
LinkedServices: 0 object(s) loaded.
Pipelines: 151 object(s) loaded.
DataFlows: 7 object(s) loaded.
Triggers: 6 object(s) loaded.
Credentials: 0 object(s) loaded.
PS /xx/azure.datafactory.tools> $foo.LinkedServices.Count                                                                              
0

Other point of view:

PS /Users/x> try { $foo = Get-AzDataFactoryV2LinkedService -ResourceGroupName xxxxdev-rg -dataFactoryName xxxx-dev-df -ErrorAction Stop } catch {Write-Host "LOL APUA!"}
LOL APUA!
PS /Users/x> try { $foo = Get-AzDataFactoryV2LinkedService -ResourceGroupName xxxxxv-rg -dataFactoryName xxxxxx-dev-df  } catch {Write-Host "LOL APUA!"}                 
Get-AzDataFactoryV2LinkedService: Unable to deserialize the response.

@NowinskiK NowinskiK merged commit 917160c into develop Jun 30, 2026
1 check passed
@NowinskiK NowinskiK deleted the issue-480 branch July 1, 2026 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

delete step fails to serialize dataset response Publish-AdfV2FromJson unable to delete resources on edge cases

2 participants