How to override an ARMTemplateParametersForFactory.json [Array as value] in GitHub Actions

Chayut Kanthawong 0 Reputation points
2024-10-02T08:43:20.22+00:00

I already got help from this "You can override the parameters in parameter file by explictly calling it out next to the parameter file. Example : parameters: repo/ARM/azuredeploy.resourcegroup.parameters.json rgName=${{env.RESOURCEGROUP_NAME}} This will override the rgName."

But the problem I got for now is I have Key, Values as this in ARMTemplateParametersForFactory.json

I already override factoryName as this in GitHub Actions

parameters: ./ARM/ARMTemplateParametersForFactory.json factoryName=test001 sta_properties_fqdns=[test002]

The error said:

Validating template... Warning: ERROR: Failed to parse string as JSON: [test002] Error detail: Expecting value: line 1 column 2 (char 1)

Warning: Template validation failed. Creating deployment... Error: ERROR: Failed to parse string as JSON: [test002] Error detail: Expecting value: line 1 column 2 (char 1)

How should I override the Array value in this case

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,437 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Amira Bedhiafi 31,391 Reputation points
    2024-10-02T19:50:37.9366667+00:00

    To override an array value in GitHub Actions for the ARMTemplateParametersForFactory.json, you need to ensure the array is formatted correctly as a JSON string. The error you are encountering happens because the array is not properly escaped as a string in the GitHub Actions YAML file.

    
    parameters: ./ARM/ARMTemplateParametersForFactory.json factoryName=test001 sta_properties_fqdns="[\"test002\"]"
    
    

    In this example, sta_properties_fqdns is being passed as a JSON array with the value ["test002"]. The inner quotes are escaped so that it is recognized as a valid JSON array.

    Try this format and it should resolve the parsing error.

    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.