问题
We have different ADF environments such as TST,UAT & prod. In each environment the self hosted IR name is different. Is it possible to parameterize the integration runtime in ADF ARM Template, so that when the ARM templates deploys through CI/CD we can pass IR name in the DevOps Variable group during the deployment.
I have tried changing the Parametrization Template in ADF with below setting, but the IR name is still not available in the ARM template parameter JSON 'arm_template_parameters.json'.
回答1:
As I searched, I found that it seams can't parameterize the integration runtime in ADF ARM Template.
Others have posted almost same question, Microsoft engineer provided some workarounds which may be helpful. He also said:
- "You mean use custom parameters to parameterize IR name ? No there is no other way."
You can ref this question: ARM Template Custom Parameters for (self-hosted)Integration Runtime.
回答2:
Hey @Aneesh and @Leon Yue, Good day!
Actually it is possible to parameterize the IR name in arm template and get it deployed based on Azure Devops :) For that you have to explicitly create a new parameter within ARM template and template parameter which you extract from ADF portal.
As seen below, till SQL Server1_properties was auto created after ARM template export. We manually created a new parameter IRName_properties_typeProperties_parametervalue"
Then within the template itself, replaced all the IR names values with the parameter :
Note : You also need to add the newly manually created parameter in the parameter template as well.
Then in Azure Devops Release pipeline, you can overwrite the parameters with the Devops variables
回答3:
Yes you can parameterize the IR runtime. but it's inner porpoerties.
You can give an alias to the IR you want to use, and use that same alias on DEV/UAT and PROD.
Then that alias will show up in your ARM template requesting a resourceId to the integration runtime to be used for it.
To be even more clear let's imagine you have 3 different ADF accounts:
- ADF_DEV
- ADF_UAT
- ADF_PRD
Someone setup a self-hosted IR and it's resource id is something like: /subscriptions/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourcegroups/some-resource-group/providers/Microsoft.DataFactory/factories/SHARED_ADF/integrationruntimes/SOMESELFHOSTEDIR
So in ADF-DEV you will have a IR like this:
{
"name": "SELFHOSTEDGW",
"properties": {
"type": "SelfHosted",
"typeProperties": {
"linkedInfo": {
"resourceId": "/subscriptions/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourcegroups/some-resource-group/providers/Microsoft.DataFactory/factories/SHARED_ADF/integrationruntimes/SOMESELFHOSTEDIR",
"authorizationType": "Rbac"
}
}
}
}
Here you can see a custom alias for the IR as SELFHOSTEDGW. Just point your linked services to this alias, an on Devops just spcifify the different resource ids for this SELFHOSTEDGW alias.
来源:https://stackoverflow.com/questions/65611283/parameterize-self-hosted-integration-runtime-in-adf-arm-template