Azure-Player / azure.datafactory.tools

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

Test-AdfLinkedService Class - Object issue cannot be found on this object #382

Open aam-a opened 7 months ago

aam-a commented 7 months ago

Currently trying to build a Powershell script to test connection of ADF Linked Services -using the Test-AdfLinkedService class for one of the two examples:

$params = @{
  DataFactoryName = 'xxxxxx'
  ResourceGroupName = 'xxxxxxx'
  SubscriptionID = 'xxxxxxx'
}

Example 1

$LinkedServiceName = 'LinkedServiceName'
$r = Test-AdfLinkedService @params -LinkedServiceName $LinkedServiceName
$r | Format-Table

Example 2

$LinkedServiceName = 'LinkedServiceName' # Comma-separated list
$r = Test-AdfLinkedService @params -LinkedServiceName $LinkedServiceName
$r.Report

Both failure due to The property 'succeeded' cannot be found on this object. Verify that the property exists.

Error:

The property 'succeeded' cannot be found on this object. Verify that the property exists.

At C:\...\...\Documents\WindowsPowerShell\Modules\azure.datafactory.tools\1.8.0\public\Test-AdfLinkedService.ps1:79 char:13
+         if ($null -ne $r -and $r.succeeded) {
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], PropertyNotFoundException
    + FullyQualifiedErrorId : PropertyNotFoundStrict
NowinskiK commented 7 months ago

Did you check what your StrictMode is? Try Set-StrictMode -Off and rerun the code.

aam-a commented 7 months ago

Thank for the feedback - set , Set-StrictMode -Off I am getting the same error

aam-a commented 6 months ago

Does anyone have any suggestion of this issue?

NowinskiK commented 6 months ago

Hi @aam-a , can you provide more information, for example, log from Azure DevOps agent?

aam-a commented 6 months ago

@NowinskiK - Thank you for the response, -there general no logs to pull. Ultimately I run this via Powershell. Can I confirm this Test-AdfLinkedService class actually working ?

NowinskiK commented 6 months ago

Yes, it's working and has unit tests cover this command + I checked that on my local machine recently.

aam-a commented 6 months ago

Thank you for the feedback, following your confirmation it is working. I have built new test environment, in which it is working accordingly, when run for individual ADF Service. I will now test again in my LIVE environment.

Noted - Same error is generated for all but the first one, if I do multiple ADF Services (separated by comma).

NowinskiK commented 6 months ago

What do you mean by "ADF Service" here? Is ADF Service = ADF instance (cloud) or ADF Linked Service? (I hope the latter one). Can you attach the log? Even if you run via PowerShell & Azure DevOps agent - you can download log content.

aam-a commented 6 months ago

To confirm,, as per the class I am using, I meant ADF Linked Service(s). Though it is a test env. There is still some sensitive data attached, will double check the full content of the logs, I will then attach accordingly if possible , thank you for the feedback

NowinskiK commented 6 months ago

Of course, remove all sensitive information before sharing. Alternatively, you can prepare PowerShell script along with additional files which run all required steps to prove what's wrong/happening, including: deploy ADF with objects, run tests.

aam-a commented 5 months ago

As discussed there are no additional logs. When trying to run the script separating the LinkedServices with comma, i.e.

$LinkedServiceName = 'LinkedServiceName', 'LinkedServiceName1', 'LinkedServiceName2' $r = Test-AdfLinkedService @params -LinkedServiceName $LinkedServiceName $r | Format-Table

It generates the following error:

Test-AdfLinkdedService: Cannot process argument transformation on paramter 'LinkedServiceName'. Cannot convert value to type System.String At C:....... ps1:28 char:55 = ... = Test-AdfLinkdedService @paramas -LinkedServiceName $LinkedServiceName       + CategoryInfo : InvalidData: (:) [Test-AdfLinkdedService], ParameterBindingArgumentTransformationException       + FullyQualifiedErrorId : ParameterBindingArgumentTransformationException,Test-AdfLinkdedService

**Please note the script work fine, if do each LinkedService individually ***