I am passing some override parameters to my Data Factory ARM template deployment step in an Azure DevOps yaml file and one global parameter in particular is specified as an ‘int’ type within the generated ARM template.
When I attempt to pass the override parameter from a variable group, Azure DevOps keeps changing it to a string instead of keeping it as an int type resulting in an error within the pipeline.
I’ve tried a few things listed below but none have worked.
Deploy task:
- task: AzureResourceManagerTemplateDeployment@3
displayName: ARM Template Deployment
inputs:
azureResourceManagerConnection:
subscriptionId:
resourceGroupName:
location:
csmFile:
csmParametersFile:
overrideParameters: >
-factoryName ${{ parameters.dataFactoryName }}
${{ parameters.overrideParameters }}
Variable in the variable group:
Doesn’t work:
variables:
- group: test-group
...
jobs:
- template: datafactory/create-release.yml@templates
parameters:
dataFactoryName: asdfasdf
overrideParameters: >
-default_properties_LogoAssetId_value $(default_properties_LogoAssetId_value_Stage)
Doesn’t work:
variables:
- group: test-group
...
jobs:
- template: datafactory/create-release.yml@templates
parameters:
dataFactoryName: asdfasdf
overrideParameters: >
-default_properties_LogoAssetId_value "[int(parameters($(default_properties_LogoAssetId_value_Stage)))]"
EDIT:
Here is a snippet of datafactory/create-release.yml
I think the issue is that I set it as a "string" type. However, I don’t know an alternative way to handle passing the override parameters as a mixture of string and int values.
- name: overrideParameters
type: string
jobs:
- deployment: Deploy
displayName: Deploy ARM Template
environment: Prod
pool:
vmImage: ubuntu-latest
strategy:
runOnce:
deploy:
steps:
- template: steps/step-arm-template-deploy.yml
parameters:
subscriptionId: ${{ parameters.subscriptionId }}
targetResourceGroupName: ${{ parameters.targetResourceGroupName }}
targetDataFactorylocation: ${{ parameters.targetDataFactorylocation }}
targetDataFactoryName: ${{ parameters.targetDataFactoryName }}
overrideParameters: ${{ parameters.overrideParameters }}
2
Answers
My workaround for now is casting my parameter in DataFactory as an int like this
@int(pipeline().globalParameters.LogoAssetId)
While not ideal, it allows me to continue to use my template as-is.
I created one sample parameter with type set to int and added it in my azure repository like below:-
I have referred the ADF ARM template from this MS Document
And I used output method at the end of my ARM template like below:-
When I added the below value in my release pipeline override parameter, I received the same error code as yours:-
Error:-
As In my ARM file I have mentioned the type as int but I was passing value in the format below, I received the error above:-
$(int(Default_properties_log))
But when I use "12345" or 1234 both will work the error did not appear and the ADF with storage account got deployed successfully in my Azure Portal, Refer below:-
My release yaml pipeline script:-
Output:-
One alternative is to create parameters.json file and add all your ARM template parameters inside it and then change the type in parameters.json and override the value in your release pipeline. Make sure the type you specify whether int or string should match the value. As, Override parameter feature will only change the value of the parameter not its type. It will read the type from your ARM template json or parameters.json.
My parameters.json file sample:-
Release.yaml with parameters.json file:-
Reference:-
AzureResourceManagerTemplateDeployment@3 – ARM template deployment v3 task | Microsoft Learn