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.

Sergiu Molnar
  • 865
  • 1
  • 11
  • 22

1 Answers1

10

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

bursson
  • 495
  • 4
  • 14