Could not find object: linkedService.SupportDatabase

MiKeZZa 21 Reputation points
2020-11-01T13:35:36.577+00:00

Hi all,

I'm not very experienced with PowerShell. But I've downloaded a solution which calls a .ps1 file. I've changed some small things to let it work with my local paths. But now it containts this:

$AdfPath = "C:\Program Files\WindowsPowerShell\Modules\azure.datafactory.tools\0.17.0\public"
$opt.CreateNewInstance = $true
$opt.DeleteNotInSource = $false
$opt.StopStartTriggers = $true
Publish-AdfV2FromJson -RootFolder $AdfPath `
    -ResourceGroupName $resourceGroupName `
    -DataFactoryName $dataFactoryName `
    -Location $region `
    -Option $opt `
    -Stage $configFilePath

And the output is this error:

Update-PropertiesFromFile : Could not find object: linkedService.SupportDatabase
At C:\Program Files\WindowsPowerShell\Modules\azure.datafactory.tools\0.17.0\public\Publish-AdfV2FromJson.ps1:160 char:9
+         Update-PropertiesFromFile -adf $adf -stage $Stage -option $op ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Update-PropertiesFromFile

The property 'Body' cannot be found on this object. Verify that the property exists.
At C:\Program Files\WindowsPowerShell\Modules\azure.datafactory.tools\0.17.0\private\Update-PropertiesFromFile.ps1:68 char:9
+         $json = $o.Body
+         ~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], PropertyNotFoundException
    + FullyQualifiedErrorId : PropertyNotFoundStrict

The variable '$json' cannot be retrieved because it has not been set.
At C:\Program Files\WindowsPowerShell\Modules\azure.datafactory.tools\0.17.0\private\Update-PropertiesFromFile.ps1:69 char:23
+         if ($null -eq $json) {
+                       ~~~~~
    + CategoryInfo          : InvalidOperation: (json:String) [], RuntimeException
    + FullyQualifiedErrorId : VariableIsUndefined

Update-PropertiesFromFile : Wrong path defined in config for object(path): linkedService.SupportDatabase(properties.typeProperties.connectionString.secretName)
At C:\Program Files\WindowsPowerShell\Modules\azure.datafactory.tools\0.17.0\public\Publish-AdfV2FromJson.ps1:160 char:9
+         Update-PropertiesFromFile -adf $adf -stage $Stage -option $op ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], DataException
    + FullyQualifiedErrorId : System.Data.DataException,Update-PropertiesFromFile
The variable '$json' cannot be retrieved because it has not been set.
At C:\Program Files\WindowsPowerShell\Modules\azure.datafactory.tools\0.17.0\private\Update-PropertiesFromFile.ps1:88 char:44
+                 Update-ObjectProperty -obj $json -path "properties.$p ...
+                                            ~~~~~
    + CategoryInfo          : InvalidOperation: (json:String) [], RuntimeException
    + FullyQualifiedErrorId : VariableIsUndefined

Save-AdfObjectAsFile : Cannot bind argument to parameter 'obj' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\azure.datafactory.tools\0.17.0\private\Update-PropertiesFromFile.ps1:104 char:41
+         $f = (Save-AdfObjectAsFile -obj $o)
+                                         ~~
    + CategoryInfo          : InvalidData: (:) [Save-AdfObjectAsFile], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Save-AdfObjectAsFile

The variable '$f' cannot be retrieved because it has not been set.
At C:\Program Files\WindowsPowerShell\Modules\azure.datafactory.tools\0.17.0\private\Update-PropertiesFromFile.ps1:105 char:23
+         $o.FileName = $f
+                       ~~
    + CategoryInfo          : InvalidOperation: (f:String) [], RuntimeException
    + FullyQualifiedErrorId : VariableIsUndefined

I've checked C:\Program Files\WindowsPowerShell\Modules\azure.datafactory.tools\0.17.0\public\Publish-AdfV2FromJson.ps1 and it contains. Line 160 contains:

Update-PropertiesFromFile -adf $adf -stage $Stage -option $opt

Is there anybody who can help me? What is going wrong here?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,624 questions
Windows for business | Windows Server | User experience | PowerShell
{count} votes

3 answers

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2020-11-01T19:54:52.347+00:00

    There's an awful lot to unpack in your problem. I don't have the code from the module you're using, but from the exception error the function you call in turn calls another function (at line 160 in Publish-AdfV2FromJson) named Update-PropertiesFromFile. That function has encountered WriteErrorException, but there's no indication as to what file it was trying to write to, or what the reason was for the exception (e.g., was it permission problem? was it trying to write to a read-only file? or was it something else?).

    Another problem is that I don't understand what you're doing when you load the $objectsToInclude variable because I don't know what sort of objects $deploymentObject.datasets, etc. are. Are they arrays, or are the strings? If they're arrays then it's okay. OTOH if they're strings you're concatenating them.

    When you're removing the string ".json" and turning forward slashes into periods, why are you starting at the second position of the string? Also, the "." in ".json" represents ANY character, not a period. Use "." instead. It probably isn't hurting anything the way it is, but it's a poor habit to acquire!

    The remainder of the exceptions are likely the result of the script continuing to run after encountering what should have been treated as a terminating error by the module's author.

    0 comments No comments

  2. MiKeZZa 21 Reputation points
    2020-11-02T18:41:11.513+00:00

    Hi @Rich Matheisen ,

    It's happening when running this script: https://github.com/mrpaulandrew/procfwk/blob/master/DeploymentTools/DataFactory/DeployProcFwkComponents.ps1. That's part of a ADF framework which I'm trying to get it working.

    Maybe that this whole script makes more sense to you?


  3. Kamil Nowinski 1 Reputation point MVP
    2020-11-25T02:04:13.17+00:00

    @MiKeZZa , the first bug I can see in your code is in the first line.
    $AdfPath shouldn't point to PowerShell module but onto Azure Data Factory folder with all subfolders with JSON files.
    Could you create a new issue on GitHub repo of azure.datafactory.tools?
    Then, I believe we can find out the root cause of your issue pretty quickly...

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.