1

I've got a data factory with 3 variables in the main pipeline.

These variables contain environment settings, so I'd therefore like them to be exposed to the ARM template. When I import the ARM template to a new environment, they are not in the variables list, only "factoryid" is shown.

enter image description here

I tried to add arm-template-parameters-definition.json (shown below) to my master branch, but it did not make a difference. This was recommended by this answer

"Microsoft.DataFactory/factories/pipelines": {
"properties": {
    "variables":{
        "*":{
            "defaultValue":"="
        }
    }
}

}

How do I get my variables recognized, so that I can set up environment configurations?

Neil P
  • 2,920
  • 5
  • 33
  • 64

2 Answers2

2

Your example is not so bad. Please double-check whether you don't make any mistake:
1) The file must be located in the root folder and named exactly: arm-template-parameters-definition.json
enter image description here
2) Verify if your file contains all necessary brackets and structure reflects what you're looking for parametrise:

{
    "Microsoft.DataFactory/factories/pipelines": {
        "properties": {
            "variables": {
                "*": {
                    "defaultValue": "="
                }
            }
        }
    }
}

3) Make sure that the file has been pushed to the repo and is present over there.
4) Remember that you must click Publish in ADF Designer (Author) to regenerate ARM templates
5) All changes go to adf-publish branch. Do you check the regenerated files exactly in that branch?


Let me show you my extremely simple example.
a) Pipeline PL_SimpleCopy with variable DbUser
Pipeline
b) File: arm-template-parameters-definition.json

{
    "Microsoft.DataFactory/factories/pipelines": {
        "properties": {
            "variables": {
                "DbUser": {
                    "defaultValue": "=:-DbUserValue"
                }
            }
        }
    }
}

c) ARM Template in ADF_Publish branch. Selected section is a parameter that you need:
enter image description here

Kamil Nowinski
  • 486
  • 3
  • 9
  • That's exactly what I thought should happen, however I still can't see it in the template. I've tried deleting the contents of the adf_publish branch to force it to regenerate, but I still get a template wirthout my variables in. – Neil P Oct 07 '19 at 08:18
  • Actually, it looks like this worked, but it's removed the parameters for all the linked services. SO now I can't repoint them to the new environment – Neil P Oct 07 '19 at 08:26
  • I can't explain why it wasn't working, but it seems to be now. In addition to the above, I found that I needed to augment this solution with the "Default" template that Microsoft silently applies. This can be found here - https://learn.microsoft.com/en-us/azure/data-factory/continuous-integration-deployment#default-parameterization-template Combining the two gets you both sets of parameters/variables – Neil P Oct 07 '19 at 10:21
-1

You can add parameters to your Azure data factory by having a parameters JSON file and deploying the ADF with the parameters as follows :

New-AzResourceGroupDeployment -Name MyARMDeployment -ResourceGroupName ADFTutorialResourceGroup -TemplateFile C:\ADFTutorial\ADFTutorialARM.json -TemplateParameterFile C:\ADFTutorial\ADFTutorialARM-Parameters.json For more information, please refer the following doc :

https://learn.microsoft.com/en-us/azure/data-factory/quickstart-create-data-factory-resource-manager-template#parameters-json

Hope this helps.

chiragMishra-msft
  • 192
  • 2
  • 4
  • 30
  • How does adding a parameter to the file map onto a pipeline parameter? Is there a reference or naming convention required? – Neil P Oct 04 '19 at 13:23
  • Hey Neil, Please refer to the following post for an alternate approach : https://stackoverflow.com/a/58165127/10653466 – chiragMishra-msft Nov 04 '19 at 07:01