{"record":{"id":"fc02ffbffc2a1f14","repo":"microsoft/aspire","slug":"a-recipe-parameter-on-radius-environment-environment-name-fc02ff","errorCode":null,"errorMessage":"A recipe parameter on Radius environment '{_environment.Name}' references Azure provider configuration, but no Azure provider is configured. Call WithAzureProvider(...) on the environment.","messagePattern":"A recipe parameter on Radius environment '(.+?)' references Azure provider configuration, but no Azure provider is configured\\. Call WithAzureProvider\\(\\.\\.\\.\\) on the environment\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs","lineNumber":5479,"sourceCode":"    /// <summary>\n    /// Resolves a <see cref=\"RadiusProviderReference\"/> to the corresponding scope value from the\n    /// cloud provider configured on this environment. Throws when the referenced provider is not\n    /// configured.\n    /// </summary>\n    private string ResolveProviderReference(RadiusProviderReference reference)\n    {\n        var providers = _environment.Annotations\n            .OfType<Annotations.RadiusCloudProvidersAnnotation>()\n            .FirstOrDefault();\n\n        return reference.Field switch\n        {\n            RadiusProviderScopeField.Region =>\n                providers?.Aws?.Region ?? throw MissingProviderReference(\"AWS\", \"WithAwsProvider\"),\n            RadiusProviderScopeField.AccountId =>\n                providers?.Aws?.AccountId ?? throw MissingProviderReference(\"AWS\", \"WithAwsProvider\"),\n            RadiusProviderScopeField.SubscriptionId =>\n                providers?.Azure?.SubscriptionId ?? throw MissingProviderReference(\"Azure\", \"WithAzureProvider\"),\n            RadiusProviderScopeField.ResourceGroup =>\n                providers?.Azure?.ResourceGroup ?? throw MissingProviderReference(\"Azure\", \"WithAzureProvider\"),\n            _ => throw new NotSupportedException($\"Unknown provider scope field '{reference.Field}'.\"),\n        };\n    }\n\n    private InvalidOperationException MissingProviderReference(string cloud, string configureMethod) =>\n        new($\"A recipe parameter on Radius environment '{_environment.Name}' references {cloud} provider \" +\n            $\"configuration, but no {cloud} provider is configured. Call {configureMethod}(...) on the environment.\");\n\n    /// <summary>\n    /// Emits a non-fatal warning for each resource-type-scoped parameter set whose resource type\n    /// has no recipe entry in the emitted recipe pack.\n    /// </summary>\n    private void WarnUnmatchedResourceTypeScopes(IEnumerable<string> emittedResourceTypes)\n    {\n        var annotation = _environment.Annotations\n            .OfType<Annotations.RadiusRecipeParametersAnnotation>()","sourceCodeStart":5461,"sourceCodeEnd":5497,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Radius/Publishing/RadiusInfrastructureBuilder.cs#L5461-L5497","documentation":"A recipe parameter on the Radius environment references the Azure provider's SubscriptionId scope field, but the environment has no Azure provider configured, so `providers?.Azure?.SubscriptionId` is null and the switch arm throws MissingProviderReference(\"Azure\", \"WithAzureProvider\"). Publish stops early with an actionable message rather than producing a manifest with an unresolved Azure scope.","triggerScenarios":"Publishing when a recipe parameter resolves RadiusProviderScopeField.SubscriptionId on an environment without `.WithAzureProvider(...)` (annotation missing or Azure block null) — thrown at RadiusInfrastructureBuilder.cs:5479.","commonSituations":"Environment created for local/AWS use then reused for Azure recipes; WithAzureProvider omitted or given without subscription; environment setup copied from a template that only registered the AWS provider.","solutions":["Call .WithAzureProvider(...) on the environment with subscription id (and resource group) configured.","Confirm the RadiusCloudProvidersAnnotation carries Azure.SubscriptionId after configuration.","Change the recipe parameter's scope field if it should not resolve Azure subscription scope.","Republish and verify the environment manifest lists the azure provider with subscription."],"exampleFix":"// before\nvar env = builder.AddRadiusEnvironment(\"env\"); // Azure recipe param needs SubscriptionId\n\n// after\nvar env = builder.AddRadiusEnvironment(\"env\")\n                 .WithAzureProvider(subscriptionId: \"sub-guid\", resourceGroup: \"rg-app\");","handlingStrategy":"validation","validationCode":"var ann = environment.Annotations.OfType<RadiusCloudProvidersAnnotation>().FirstOrDefault();\nif (ann?.Azure?.SubscriptionId is null) throw new InvalidOperationException(\"Environment needs .WithAzureProvider(...) with a subscription id before Azure-scoped recipes.\");","typeGuard":null,"tryCatchPattern":"try {\n  await publishPipeline.ExecuteAsync(ct);\n} catch (InvalidOperationException ex) when (ex.Message.Contains(\"WithAzureProvider\")) {\n  // register the Azure provider on the environment and republish\n}","preventionTips":["Call WithAzureProvider (subscription + resource group) on all environments running Azure recipes.","Centralize environment construction so provider registration can't be dropped in copies.","Check for an azure provider block in the generated environment manifest pre-publish."],"tags":["radius","azure","provider","publishing","configuration"],"backgroundTag":"missing-configuration","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}