{"record":{"id":"c6692d680719e8a4","repo":"microsoft/aspire","slug":"azure-resource-resource-name-is-missing-required-output-name","errorCode":null,"errorMessage":"Azure resource '{resource.Name}' is missing required output '{name}'. Ensure Azure infrastructure provisioning completed successfully.","messagePattern":"Azure resource '(.+?)' is missing required output '(.+?)'\\. Ensure Azure infrastructure provisioning completed successfully\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxContainerDeployment.cs","lineNumber":2317,"sourceCode":"        }\n    }\n\n    private static string GetRequiredStateValue(DeploymentStateSection section, string name)\n    {\n        var value = section.Data[name]?.GetValue<string>();\n        if (string.IsNullOrWhiteSpace(value))\n        {\n            throw new InvalidOperationException($\"Deployment state section '{section.SectionName}' is missing required value '{name}'.\");\n        }\n\n        return value;\n    }\n\n    private static string GetRequiredOutput(AzureBicepResource resource, string name)\n    {\n        if (!resource.Outputs.TryGetValue(name, out var value) || value is null || string.IsNullOrWhiteSpace(value.ToString()))\n        {\n            throw new InvalidOperationException($\"Azure resource '{resource.Name}' is missing required output '{name}'. Ensure Azure infrastructure provisioning completed successfully.\");\n        }\n\n        return value.ToString()!;\n    }\n\n    internal static AzureDevComputeResourceScope CreateDataPlaneScope(AzureSandboxGroupResource sandboxGroup)\n    {\n        ArgumentNullException.ThrowIfNull(sandboxGroup);\n\n        var resourceId = new global::Azure.Core.ResourceIdentifier(GetRequiredOutput(sandboxGroup, \"id\"));\n        if (string.IsNullOrWhiteSpace(resourceId.SubscriptionId) ||\n            string.IsNullOrWhiteSpace(resourceId.ResourceGroupName) ||\n            string.IsNullOrWhiteSpace(resourceId.Name))\n        {\n            throw new InvalidOperationException(\n                $\"Azure sandbox group '{sandboxGroup.Name}' returned an invalid resource ID '{resourceId}'.\");\n        }\n","sourceCodeStart":2299,"sourceCodeEnd":2335,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxContainerDeployment.cs#L2299-L2335","documentation":"Thrown by GetRequiredOutput when an AzureBicepResource's Outputs dictionary does not contain the requested key, the value is null, or its string form is blank. The library relies on Bicep deployment outputs to wire sandbox resources together and treats a missing output as a provisioning failure.","triggerScenarios":"GetRequiredOutput(resource, \"id\") (or similar) on an AzureBicepResource whose Outputs collection lacks the named output — e.g. the resource was never provisioned, provisioning failed partway, or the Bicep module does not declare the output.","commonSituations":"Running against a resource whose `azd`/ARM deployment never completed; referencing an output renamed in a newer Bicep template; the AppHost started without the infrastructure provisioning phase having run.","solutions":["Ensure the Azure infrastructure provisioning completed successfully before consuming outputs; check provisioning logs for errors.","Confirm the Bicep module actually declares the required `output` with the exact name requested.","Re-run the deployment to repopulate outputs if the previous run failed.","Verify the AzureBicepResource instance is the one that was deployed, not a stand-in/placeholder resource."],"exampleFix":"// before: bicep module without output\nresource sandboxGroup '...' = { ... }\n// after: declare the output\noutput id string = sandboxGroup.id","handlingStrategy":"validation","validationCode":"bool HasOutput(AzureBicepResource r, string name) =>\n    r.Outputs.TryGetValue(name, out var v) && v is not null && !string.IsNullOrWhiteSpace(v.ToString());","typeGuard":null,"tryCatchPattern":"try { var id = GetRequiredOutput(resource, \"id\"); }\ncatch (InvalidOperationException ex) { logger.LogError(ex, \"Provisioning output missing on {Resource}\", resource.Name); throw; }","preventionTips":["Declare every consumed output in the Bicep module.","Gate consumption on successful provisioning completion.","Keep Bicep output names in sync with GetRequiredOutput call sites."],"tags":["azure","bicep","provisioning","outputs"],"backgroundTag":"missing-required-config-field","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"}