skip to Main Content

I’m a beginner at Microsoft Azure so please bear with me. I’m following this tutorial on deploying bicep templates with parameters, my bicep file is the exact same as the one in the tutorial. However, when I attempt to deploy it I get the following error

New-AzResourceGroupDeployment : A parameter cannot be found that matches parameter name 'location'.

The location parameter definitely exists. I’m deploying with the following command:

New-AzResourceGroupDeployment -ResourceGroupName ResourceGroup -TemplateFile c:UsersNameDesktopfilesazuretestingtest.bicep -location region -storagename storageaccountname -storagetype Standard_LRS -WhatIf

Any help would be appreciated!

3

Answers


  1. It looks like the tutorial contains an error. In the official documentation, there is no location parameter in the New-AzResourceGroupDeployment cmdlet.

    Also, you have already specified a resource group, and the resources you describe with bicep contain a location. So the location parameter makes no sense here – just leave it out!

    Note that you can also deploy your bicep files using the Azure CLI. See Deploy local Bicep file

    Login or Signup to reply.
  2. A way to not have to put in the location for a resource if you have all resources in the same location is to make use of

    enter image description here

    enter image description here

    So as long as you have run this command, it will apply for all bicep files you run with it configured as such:

    enter image description here

    This means you don’t need to provide it with every CLI command for bicep.

    I followed this tutorial series and found it fantastic:

    Beginner

    Intermediate

    Advanced

    Login or Signup to reply.
  3. What the New-AzResourceGroupDeployment command allows you to do is supply parameter values via PowerShell params. So while the command has its own parameters and location is not one of them, any extra parameters supplied to the command are passed as template parameters. If the template does not have a parameter named location (for example) – you’ll see that error.

    That error is usually pretty accurate, so the template may very well not have a parameter named location. Check to make sure the file c:UsersNameDesktopfilesazuretestingtest.bicep has a location param, and that you’ve saved the file since changing it (I forget that often).

    If that doesn’t unblock, share your file/code and that may help debug.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search