Search code examples
azureazure-data-factory

Deploying ARM Template with override parameters in Azure DevOps is converting int values as string type


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.

enter image description here

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.

enter image description here

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:

enter image description here

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 }}

Solution

  • 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.