azure.datafactory.tools icon indicating copy to clipboard operation
azure.datafactory.tools copied to clipboard

Dynamic environment variables in the config file not working in ubuntu based build agents

Open nikhil-neu opened this issue 4 years ago • 8 comments

Describe the bug Env variables in config variables not working in ubuntu build agents . Getting the error Validation of config file completed. Update-PropertiesForObject: /root/.local/share/powershell/Modules/azure.datafactory.tools/0.95.1/private/Update-PropertiesFromFile.ps1:75 Line | 75 | … $null = Update-PropertiesForObject -o $_ -action $action -path $p … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Cannot bind argument to parameter 'value' because it is an | empty string.

To Reproduce Using this config file

Your script to reproduce the behaviour:

{
    "akv_ls_amnoneshd": [
      {
        "name": "$.properties.typeProperties.baseUrl",
        "value": "https://co-wus2-amnoneshd-kv-t01.vault.azure.net/",
        "action": "update"
      }
    ],
    "sql_ls_amie_amhdb": [
      {
        "name": "$.properties.connectVia.referenceName",
        "value": "ADFIntegrationRuntime",
        "action": "update"
      }
    ]
}

Expected behaviour Config file should be used to paramterise the json files

Version of PowerShell module of: latest

  • ver.........

nikhil-neu avatar Jan 28 '22 14:01 nikhil-neu

I run (under UBUNTU agent) the subset of unit tests included in the module and it works fine: image

As an additional check I run this PS script under Ubuntu agent:

$m = 'azure.datafactory.tools'
Install-Module $m -Scope CurrentUser
Import-Module $m

$RootFolder = 'X:\!WORK\GitHub\!SQLPlayer\azure.datafactory.tools\test\BigFactorySample2'
$config = 'X:\!WORK\GitHub\!SQLPlayer\azure.datafactory.tools\test\BigFactorySample2\deployment\config-c100.json'

Publish-AdfV2FromJson -RootFolder $RootFolder -ResourceGroupName 'as' -DataFactoryName 'xyz' -Stage $config -DryRun

The above code finished successfully either, until empty value met, which is expected: image

All previous configuration items have been processed properly. Do double-check your values or variables. You can switch DEBUG mode ON to see more details.

NowinskiK avatar Jan 31 '22 20:01 NowinskiK

@NowinskiK .. but my value isnt empty .. Here is my config file type,name,path,value linkedService,akv_ls_amnoneshd,typeProperties.baseUrl,"$Env:kvURI" linkedService,sql_ls_amie_amhdb,connectVia.referenceName,"intRunTimeAmnOneAmieDev" i enabled verbose ` Validation of config file completed. VERBOSE: - Performing: update for object(path): linkedService.akv_ls_amnoneshd(properties.typeProperties.baseUrl) VERBOSE: Entering Function: ConvertFrom-ArraysToOrderedHashTables VERBOSE: Processing PSCustomObject... VERBOSE: Properties: name type properties VERBOSE: Processing property 'name' of type String VERBOSE: Processing property 'type' of type String VERBOSE: Processing property 'properties' of type PSCustomObject VERBOSE: Converting PSCustomObject property using a recursive function call... VERBOSE: Entering Function: ConvertFrom-ArraysToOrderedHashTables VERBOSE: Processing PSCustomObject... VERBOSE: Properties: annotations type typeProperties VERBOSE: Processing property 'annotations' of type Object[] VERBOSE: Processing property 'type' of type String VERBOSE: Processing property 'typeProperties' of type PSCustomObject VERBOSE: Converting PSCustomObject property using a recursive function call... VERBOSE: Entering Function: ConvertFrom-ArraysToOrderedHashTables VERBOSE: Processing PSCustomObject... VERBOSE: Properties: baseUrl VERBOSE: Processing property 'baseUrl' of type String Update-PropertiesForObject: /root/.local/share/powershell/Modules/azure.datafactory.tools/0.95.1/private/Update-PropertiesFromFile.ps1:75 Line | 75 | … $null = Update-PropertiesForObject -o $_ -action $action -path $p … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Cannot bind argument to parameter 'value' because it is an | empty string.

##[error]PowerShell exited with code '1'. `

The same task can be passing here , when run on a windows agent with everything remaining same

VERBOSE: Properties: annotations type typeProperties VERBOSE: Processing property 'annotations' of type Object[] VERBOSE: Processing property 'type' of type String VERBOSE: Processing property 'typeProperties' of type PSCustomObject VERBOSE: Converting PSCustomObject property using a recursive function call... VERBOSE: Entering Function: ConvertFrom-ArraysToOrderedHashTables VERBOSE: Processing PSCustomObject... VERBOSE: Properties: baseUrl VERBOSE: Processing property 'baseUrl' of type String VERBOSE: Entering Function: ConvertFrom-OrderedHashTablesToArrays VERBOSE: Processing PSCustomObject... VERBOSE: Properties: name type properties VERBOSE: Processing property 'name' of type String VERBOSE: Processing property 'type' of type String VERBOSE: Processing property 'properties' of type PSCustomObject VERBOSE: Converting PSCustomObject property using a recursive function call... VERBOSE: Entering Function: ConvertFrom-OrderedHashTablesToArrays VERBOSE: Processing PSCustomObject... VERBOSE: Properties: annotations type typeProperties VERBOSE: Processing property 'annotations' of type Object[] VERBOSE: Processing property 'type' of type String VERBOSE: Processing property 'typeProperties' of type PSCustomObject VERBOSE: Converting PSCustomObject property using a recursive function call... VERBOSE: Entering Function: ConvertFrom-OrderedHashTablesToArrays VERBOSE: Processing PSCustomObject... VERBOSE: Processing property 'baseUrl' of type String VERBOSE: - Performing: update for object(path): linkedService.sql_ls_amie_amhdb(properties.connectVia.referenceName) VERBOSE: Entering Function: ConvertFrom-ArraysToOrderedHashTables VERBOSE: Processing PSCustomObject...

nikhil-neu avatar Feb 08 '22 13:02 nikhil-neu

Can you attach both files of Linked Services?

NowinskiK avatar Feb 08 '22 15:02 NowinskiK

@NowinskiK akv_ls_amnoneshd

{ "name": "akv_ls_amnoneshd", "type": "Microsoft.DataFactory/factories/linkedservices", "properties": { "annotations": [], "type": "AzureKeyVault", "typeProperties": { "baseUrl": "https://co-wus2-xxxxxxx-kv-d01.vault.azure.net/" } } }

sql_ls_amie_amhdb { "name": "sql_ls_xxxx_amhdb", "type": "Microsoft.DataFactory/factories/linkedservices", "properties": { "annotations": [], "type": "SqlServer", "typeProperties": { "connectionString": { "type": "AzureKeyVaultSecret", "store": { "referenceName": "akv_ls_amnoneshd", "type": "LinkedServiceReference" }, "secretName": "xxxdb-sqlconnection-adf" } }, "connectVia": { "referenceName": "intRunTimexxxOneAmieDev", "type": "IntegrationRuntimeReference" } } }

nikhil-neu avatar Feb 08 '22 16:02 nikhil-neu

@NowinskiK ... any work around for this ?

nikhil-neu avatar Feb 15 '22 12:02 nikhil-neu

I'm on holiday right now. I will back to this as soon as I can. In the meantime, you can investigate it on your own.

NowinskiK avatar Feb 19 '22 22:02 NowinskiK

@NowinskiK .. i have been still unable to find a work around for this , would you be having ideas ?

nikhil-neu avatar May 10 '22 18:05 nikhil-neu

Unfortunately, I don't have too much capacity now, so we must ask someone from the community to investigate this issue deeper.

NowinskiK avatar May 14 '22 20:05 NowinskiK