Skip to content

Radius.Core/environments providers.azure.resourceGroupName is schema-optional but effectively required for Azure recipes #12465

Description

@zachcasper

Summary

Radius.Core/environments providers.azure.resourceGroupName is optional in the schema, but Azure Bicep and Terraform Recipes require a resource group. Omitting it passes validation yet produces broken Azure deployments with no early error.

Steps to reproduce

  1. Create an Environment with an Azure provider that sets subscriptionId but omits resourceGroupName:

    resource myEnvironment 'Radius.Core/environments@2025-08-01-preview' = {
      name: 'my-environment'
      properties: {
        providers: {
          azure: {
            subscriptionId: '00000000-0000-0000-0000-000000000000'
          }
        }
      }
    }
  2. Deploy an application whose resources use an Azure (Bicep or Terraform) Recipe to this Environment.

Observed behavior

The recipe-config bridge builds the Azure scope without a resource group when resourceGroupName is empty (pkg/recipes/configloader/environment.go, ~L166):

scope := "/subscriptions/" + Azure.SubscriptionId
if Azure.ResourceGroupName != "" {
    scope += "/resourceGroups/" + Azure.ResourceGroupName
}

The resulting scope is /subscriptions/<id> with no resource group and no default. recipecontext then populates context.azure.resourceGroup.name from that scope (pkg/recipes/recipecontext/context.go, ~L81), leaving it empty. Recipes that read context.azure.resourceGroup.name (effectively all Azure Recipes) fail or deploy incorrectly.

Expected behavior

Either the resource group is required when the Azure provider is configured, or Radius fails fast with a clear error when it is missing. A schema-valid Environment should not silently break every Azure Recipe.

Root cause

resourceGroupName is modeled as optional (resourceGroupName? in TypeSpec, json:"resourceGroupName,omitempty" in the datamodel), but the runtime and recipe context treat a resource group as required for Azure deployments. The schema contract and the runtime contract disagree.

Proposed options

  1. Make resourceGroupName required in the schema and datamodel when the azure provider is present.
  2. Validate at deploy time and return a clear error if the Azure provider has no resource group.
  3. Intentionally support subscription-scoped deployments and document that Recipes must then supply their own resource group.

Additional context

Surfaced while writing property descriptions for Radius.Core/environments (related: #12429, #12430). As an interim measure, the resourceGroupName description notes that it is effectively required for Azure Recipes.

Metadata

Metadata

Labels

bugSomething is broken or not working as expectedtriagedThis issue has been reviewed and triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions