matendie
matendie

Reputation: 763

What does the "One of the deployment parameters has an empty key" mean in VSTS ARM release

My ARM template resource group deployment fails in VSTS.

I get an error without any specific reference to parameter that has an issue: "One of the deployment parameters has an empty key. Please see https://aka.ms/arm-deploy/#parameter-file for details."

The referenced url contain general information, with one comment asking the same question, but no answer to it. Person asking it alluded that it may have something to do with the version of the deployment step (2.*) and it not using Powershell anymore. I went though the template back and forth comparing parameters in BeyondCompare and nothing sticks out...

Does anyone know what does this error mean?

Upvotes: 16

Views: 10698

Answers (8)

Martin Larsson
Martin Larsson

Reputation: 720

In my case I had added a newline for each parameter ovverrides which resulted in loads of:

There was an error while overriding '' parameter because of 'TypeError: Cannot read properties of undefined...

Once I deleted the newline character and had all paramter overrides on one line I got rid of this error.

Im using a release pipeline and the "ARM Template deployment"-task and pressing the ellipses next to the field "Ovverride template parameters". Instead of editing in the narrow window I pressed OK and copied the field content to a texteditor and added newlines for readability (WRONG!). Then pasted the edited text into the field in the release pipeline again.

Upvotes: 0

Sachin Joseph
Sachin Joseph

Reputation: 19697

Ran into this the other day. The release pipeline used to be working, and it suddenly started failing continuously with this error:

Screenshot of ARM release pipeline failure

Error text:

##[error] One of the deployment parameters has an empty key. Please see https://aka.ms/resource-manager-parameter-files for details.
##[warning] Validation errors were found in the Azure Resource Manager template. This can potentially cause template deployment to fail. Task failed while creating or updating the template deployment.. Please follow https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-syntax
Starting Deployment.
Deployment name is TemplateDeployment-20220504-******-****
There were errors in your deployment. Error code: InvalidDeploymentParameterKey.
##[error] One of the deployment parameters has an empty key. Please see https://aka.ms/resource-manager-parameter-files for details.
##[error] Check out the troubleshooting guide to see if your issue is addressed: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops#troubleshooting
##[error] Task failed while creating or updating the template deployment.

Change that caused the error


I had changed the build pipeline such that the build numbers would now have spaces in it: so it changed from my-build-number to my build number. I was still using template param overrides this way: -buildNumber $(Build.BuildNumber): Screenshot showing override params without quotes this would expand to -buildNumber my build number, which breaks the command line processing of the ARM template deployment release task.

Solution


Used quotes for my build number variable: -buildNumber "$(Build.BuildNumber)": Screenshot showing override params with quotes

Now this would expand to -buildNumber "my build number", and the Azure Resource Manager (ARM) template deployment release task is happy:

Screenshot of release pipeline succeeding

Upvotes: 1

JVGBI
JVGBI

Reputation: 575

It means you've got a parameterkey in your deployment template without a name. For example "-" instead of "-parametername" or "- parametername" (notice the space).

It can also happen if you manage to paste an 'em-dash' (e.g. from a web browser) instead of a standard dash.

Upvotes: 3

Piotr Perak
Piotr Perak

Reputation: 11118

In my case the problem was with template parameters override. I needed to put parameter value in quotes - "DEV" on screenshot below.

enter image description here

Upvotes: 0

Sagar Kulkarni
Sagar Kulkarni

Reputation: 686

Check Your parameter key or value does not have space in between. if your value required space then, use "". check this link.

Example,

direct value -param1 "Value with Space"

value from pipeline variables -param1 "$(valueFromVariables)".

Upvotes: 6

plavixo
plavixo

Reputation: 181

We had the same as matendie; a space between the dash and the parameter name:

- pricingTier "standard"

^ note the space

Upvotes: 2

Gclpixel
Gclpixel

Reputation: 341

I had the same issue and found out that some parameters has a space in their values. So you should write -adminUsername "$(vmuser)". This works for me

Upvotes: 34

matendie
matendie

Reputation: 763

So, I'm not sure what the issue was, but I gave up on trying to identify the problem, and I deleted the release definition. Recreating it from scratch using the same template, works fine now...

Maybe the definition got some how corrupted. Not sure, but new one is not having this issue.

Thanks

Upvotes: 0

Related Questions