Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Azure Resource Group using Bicep

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.

like image 786
Sergiu Molnar Avatar asked Jun 23 '26 10:06

Sergiu Molnar


1 Answers

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

like image 82
bursson Avatar answered Jun 25 '26 18:06

bursson