Sorry for long post, I need to explain it properly for people to undertsand.
I have a pipeline in datafctory that triggers a published AML endpoint:
I am trying to parametrize this ADF pipeline so that I can deploy to test and prod, but on test and prod the aml endpoints are different.
Therefore, I have tried to edit the parameter configuration in ADF as shows here:
Here in the section Microsoft.DataFactory/factories/pipelines
I add "*":"="
so that all the pipeline parameters are parametrized:
"Microsoft.DataFactory/factories/pipelines": {
"*": "="
}
After this I export the template to see which parameters are there in json, there are lot of them but I do not see any paramter that has aml endpoint name as value, but I see the endpint ID is parametrized.
My question is: Is it possible to parametrize the AML endpoint by name? So that, when deploying ADF to test I can just provide the AML endpoint name and it can pick the id automatically:
3
Answers
i faced the similar issue when deploying adf pipelines with ml between environments. Unfortunately, As of now, adf parameter file do not have ml pipeline name as parameter value. only turn around solution is modifiying the parameter file(json) file with aligns with your pipeline design. For example, i am triggering ml pipeline endpoint inside foreach activity–>if condition–>ml pipeline
Here is my parameter file values:
after you export the ARM template, the json file has records for your ml endpoints
it is lot of manual effort to maintain if design is frequently changing so far worked for me. Hope this answers your question.
I finally fixed this.
The trick is to not chose Pipeline Endpoint ID but to choose Pipeline ID.
Pipeline ID can be parametrized and I have set up this to come from a global parameter. Therefore I do not need to find the right level of identation everytime
Then:
Later you add the global parameters to your ARM template:
And in the parameter template you add:
Finally I wrote a python CLI tool to get the latest pipeline ID for a given published pipeline id:
By printing the variables in these way they are added to environment variables that later I can pick in the ARM deploy step:
And then we have our desired setup:
Different pipeline IDs for different environments.
Maybe material for a blog post as it works like charm.
Making changes to ADF(ARMTemplateForFactory.json) or Synapse(TemplateForWorkspace.json) inside DevOps CI/CD pipeline
Sometimes parameters are not automatically added to parameter file i.e ARMTemplateParametersForFactory.json/TemplateParametersForWorkspace.json, for example MLPipelineEndpointId.
In case of ML pipeline you can use PipelineId as parameter ,but can change every time ML pipeline is updated.
You can solve this issue by replacing the value in ADF(ARMTemplateForFactory.json) or Synapse(TemplateForWorkspace.json), using Azure Powershell.
Idea is simple, you use powershell to open the ArmTemplate and replace the value based upon the env and it works exactly like overwriting parameters within DevOps.
This editing is done on the fly i.e the devOps artifact is updated and not the repo file, the ADF/Synapse repository won’t change..just like how it’s done while over writting parameters.
Issue
We currently have two environments for Synapse called bla-bla-dev and bla-bla-test. Now dev synapse environment is using dev machine learning environment and test synapse environment is using test ML environment.
But the MLPipelineEndpointId is grayed out on dev synapse and the parameter is not present in parameter file so it can’t be overwritten normally.
enter image description here
Solution
Use Azure Powershell to run below command:-
Steps
devOps pipeline variable one for dev environment (One to be replaced) and then another one for test environment (Test MLPipelineEndpointId for test synapse pipeline).
enter image description here
Add Azure Powershell step in ADF/Synapse release devOps pipeline.
This CI/CD has to be placed before arm template deployment step.
(Get-Content $(System.DefaultWorkingDirectory)/Artifacts_source/bla-bla-dev/TemplateForWorkspace.json).Replace($(scoringMLPipelineEndPointDev), $(scoringMLPipelineEndPoint)) | Set-Content $(System.DefaultWorkingDirectory)/Artifacts_source/bla-bla-dev/TemplateForWorkspace.json
enter image description here
Once deployment you will see that you test environment is pointing to test MLpipelineEndpoinId.