4

I have an ARM template that deploys Key Vault and populates it with secrets. It does creates secrets, based on how many arrays are in the parameter secretsObject. For example if I have:

"secretsObject": {
  "type": "secureObject",
  "defaultValue": {
    "secrets": [
      {
        "secretName": "exampleSecret1",
        "secretValue": "secretVaule1"
      },
      {
        "secretName": "exampleSecret2",
        "secretValue": "secretValue2"
      }
    ]
  }
}

The template will create 2 Secrets. So this is the line that I put into .parameters.json to deploy the template from Visual Studio:

        "secrets": [
      {
        "secretName": "exampleSecret1",
        "secretValue": "secretVaule1"
      },
      {
        "secretName": "exampleSecret2",
        "secretValue": "secretValue2"
      }
    ]

The problem is I can't figure out how to past such line into VSTS as a variable (to overwrite parameter). This is the ARM template I'm using

There were errors in your deployment. Error code: InvalidDeploymentParameterKey.
One of the deployment parameters has an empty key. Please see https://aka.ms/arm-deploy/#parameter-file for details.
Processed: ##vso[task.issue type=error;]One of the deployment parameters has an empty key. Please see https://aka.ms/arm-deploy/#parameter-file for details.
task result: Failed
Task failed while creating or updating the template deployment.

enter image description here

enter image description here

WinBoss
  • 879
  • 1
  • 17
  • 40
  • You may check the source code of how it parses the parameters https://github.com/Microsoft/vsts-tasks/tree/master/Tasks/AzureResourceGroupDeployment – starian chen-MSFT Dec 25 '17 at 06:58
  • The value is the object, so try to specify the value to `{"secrets":[{......}]}` – starian chen-MSFT Dec 25 '17 at 09:49
  • Yes, that's what I'm referencing. I've just referenced `{"secrets":[{"secretName":"exampleSecret1","secretValue":"secretVaule1"},{"secretName":"exampleSecret2","secretValue":"secretValue2"},{"secretName":"exampleSecret3","secretValue":"secretVaule3"}]}` and received an error: `Deployment template validation failed: 'The provided value for the template parameter 'secretsObject' at line '1' and column '1411' is not valid.'. Task failed while creating or updating the template deployment.` – WinBoss Dec 25 '17 at 14:28
  • I am facing the same issue, can you please tell me if you resolve this issue. – Pradeep Apr 13 '18 at 13:56
  • No, didn’t solve this. – WinBoss Apr 13 '18 at 14:48

1 Answers1

2

There is the issue in Azure Resource Group deployment task and I submit a feedback here: VSTS build/release task: Override template parameters of Azure Resource Group Deployment.

The workaround is that you can update the parameter file during the build/release (e.g. parameter.json) and specify this parameter file in Azure Resource Group deployment task.

There are many ways to update file, such as Replace Tokens.

Update:

Feedback in Gitgub: https://github.com/Microsoft/vsts-tasks/issues/6108

starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53