8

I'm trying to create an Azure Resource Group using a .bicep file:

targetScope = 'subscription'

param environment string
param location string = deployment().location

resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  name: 'snapshot-generator-${environment}-west-eu'
  location: location
}

And for deploy I'm using the following command in PowerShell:

New-AzResourceGroupDeployment  -TemplateFile resourceGroup.bicep

but the ResourceGroupName is requested and I can't understand why and what I'm doing wrong.

1 Answer 1

9
Answer recommended by Microsoft Azure Collective

You should use New-AzSubscriptionDeployment instead of New-AzResourceGroupDeployment for a subscription-level deployment. See here for more.

Sign up to request clarification or add additional context in comments.

1 Comment

ResourceGroupName is a mandatory parameter which defeats the purpose of using a bicep file learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.