Coder Perfect

Using Bicep, create an Azure Resource Group.


I’m trying to use a.bicep file to create an Azure Resource Group:

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

In PowerShell, I’m using the following command to deploy:

New-AzResourceGroupDeployment  -TemplateFile resourceGroup.bicep

However, the ResourceGroupName is required, and I’m not sure why or what I’m doing wrong.

Asked by Sergiu Molnar

Solution #1

For a subscription-level deployment, New-AzSubscriptionDeployment should be used instead of New-AzResourceGroupDeployment. For more information, go here.

Answered by bursson

Post is based on