New-AzureRmResourceGroupDeployment: Unable to combine parameterURI file and inline parameters
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?
@ravbhatnagar Can you take a look?
This is an issue. Adding to backlog.
@ravbhatnagar Please close this issue if fixed, or assign to the appropriate milestone
Still having this issue - any plans to fix?
@ravbhatnagar ping
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?
No ETA for a Fix yet? Still unable to pass Inline parameters when TemplateUri and TemplateParameterUri are used.
: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.