azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

New-AzureRmResourceGroupDeployment: Unable to combine parameterURI file and inline parameters

Open thbowker opened this issue 10 years ago • 9 comments

Using New-AzureRmResourceGorupDeployment

Seeing different behavior using -TemplateFile/-TemplateParameterFile and -TemplateURI/-TemplateParemeterURI.

Using a local file (-TemplateFile/-TemplateParameterFile) I am able to pass inline parameters when defined in -TemplateParameterFile as null. The value supplied in the inline parameter overwrites the null value and the deployment is successful:

New-AzureRmResourceGroupDeployment -Name RBDeploy -ResourceGroupName rg -TemplateFile ".../templates/template.json" -TemplateParameterFile "....../templates/templateparameters.json -vmName "Testing123"

However, when using URI instead of a local file, I receive the following error:

New-AzureRmResourceGroupDeployment -Name RBDeploy -ResourceGroupName rg -TemplateURI ".Https:../templates/template.json" -TemplateParameterURI "Https:.../templates/templateparameters.json -vmName "Testing123"

New-AzureRmResourceGroupDeployment : 7:10:46 PM - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The template resource '' at line '92' and column '6' is not 
valid. The name property cannot be null or empty. Please see http://aka.ms/arm-template/#resources for usage details.'.
At line:2 char:1
+ New-AzureRmResourceGroupDeployment -Name RBDeploy -ResourceGroupName  ...

Why am I able to pass inline parameters using a local file but not a URI?

thbowker avatar Jun 07 '16 00:06 thbowker

@ravbhatnagar Can you take a look?

markcowl avatar Jun 09 '16 18:06 markcowl

This is an issue. Adding to backlog.

ravbhatnagar avatar Jul 12 '16 18:07 ravbhatnagar

@ravbhatnagar Please close this issue if fixed, or assign to the appropriate milestone

markcowl avatar Sep 12 '16 19:09 markcowl

Still having this issue - any plans to fix?

charisk avatar Nov 06 '17 10:11 charisk

@ravbhatnagar ping

cormacpayne avatar Jul 06 '18 17:07 cormacpayne

Still seems to be an issue as I am unable to discover parameters located in JSON file when using -templateURI parameter. Is the only workaround to use the templatefile parameter?

fluffydice avatar Nov 25 '19 10:11 fluffydice

No ETA for a Fix yet? Still unable to pass Inline parameters when TemplateUri and TemplateParameterUri are used.

Voteax avatar May 22 '20 11:05 Voteax

:bell: Routing this issue to @act-identity-squad.

Thanks for your patience — this was recently picked up as an outstanding open issue for the ARM Deployments team to review.

You're correct that there's an asymmetry here: the -TemplateParameterFile code path layers inline -<paramName> overrides on top of the values in the file, but the -TemplateParameterUri path doesn't apply that same merge — the URI's values come through, and the inline overrides are effectively ignored. @ravbhatnagar acknowledged it as a real issue in 2016, and from what I can tell the proposed backlog fix never landed.

For the use case in the original issue (a template hosted at a URI plus a few inline overrides), the supported pattern today is -TemplateParameterObject:

$overrides = @{
    vmName       = 'Testing'
    adminUser    = 'azureuser'
    # ...any other inline values you want to apply
}

New-AzResourceGroupDeployment `
    -ResourceGroupName rg `
    -TemplateUri 'https://.../template.json' `
    -TemplateParameterObject $overrides

That hashtable path merges cleanly regardless of whether the template itself is local or URI-hosted, and it composes naturally if you want to pull a base set of parameters in code and override a few.

If you're authoring new templates, .bicepparam is the modern path — parameters-as-code with full IntelliSense, and New-AzResourceGroupDeployment -TemplateParameterFile foo.bicepparam works symmetrically with -TemplateFile foo.bicep (or -TemplateUri for the compiled JSON).

Given that the workaround is stable, I'm going to close this one out. Please reopen (or open a fresh issue and tag me) if -TemplateParameterObject doesn't cover what you need.

torreymicrosoft avatar May 21 '26 19:05 torreymicrosoft