Azure-Player / azure.datafactory.tools

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

environment variables deployment issue #112

Closed RayCodeAway closed 3 years ago

RayCodeAway commented 3 years ago

I have a csv to replace replace properties environment-related values

the environment variable value used to replace a Linked Service Azure Connection name using the record below

type,name,path,value linkedService,LS_SQLDB_ConfigDB,typeProperties.connectionString.secretName,"scrt-sqldb-devconfigdb"

this no longer works

the error i get is

[error]Invalid JSON primitive: scrt-sqldb-devconfigdb.

MangroveGit commented 3 years ago

I think this is caused by the way that the parameter value is set in the Linked Service - if it is set statically the parameter value you have provided would work. If on the other hand the Linked Service parameter value is set as an expression the property would need to be updated to "linkedService,LS_SQLDB_ConfigDB,typeProperties.connectionString.secretName.value,"scrt-sqldb-devconfigdb".

NowinskiK commented 3 years ago

Can you paste the body of the file LS_SQLDB_ConfigDB here?

NowinskiK commented 3 years ago

If your code looks similar to this:

{
    "name": "LS_AzureSqlDb_AW2014_SqlAuth",
    "type": "Microsoft.DataFactory/factories/linkedservices",
    "properties": {
        "annotations": [],
        "type": "AzureSqlDatabase",
        "typeProperties": {
            "connectionString": "Integrated Security=False;Encrypt=True;Connection Timeout=30;Data Source=sqlplayer.database.windows.net;Initial Catalog=AdventureWorks2014;User ID=kamil@sqlplayer",
            "password": {
                "type": "AzureKeyVaultSecret",
                "store": {
                    "referenceName": "LS_AzureKeyVault",
                    "type": "LinkedServiceReference"
                },
                "secretName": "sqlplayer-sqlserver-password"
            }
        }
    }
}

Then config:

type,name,path,value
linkedService,LS_AzureSqlDb_AW2014_SqlAuth,typeProperties.password.secretName,"scrt-sqldb-devconfigdb"

This should works, however, bear in mind that name of secrets should be idempotent across environments. Having one instance of Azure KeyVault per environment resolves that problem and is the best practice.