{"record":{"id":"cca8d9997d9c299c","repo":"microsoft/aspire","slug":"azure-provisioning-options-can-t-be-changed-because-the","errorCode":null,"errorMessage":"Azure provisioning options can't be changed because the interaction service is unavailable.","messagePattern":"Azure provisioning options can't be changed because the interaction service is unavailable\\.","errorType":"validation","errorClass":"MissingConfigurationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure/Provisioning/Internal/RunModeProvisioningContextProvider.cs","lineNumber":77,"sourceCode":"        var normalizedApplicationName = ResourceGroupNameHelpers.NormalizeResourceGroupName(_environment.ApplicationName.ToLowerInvariant());\n        if (normalizedApplicationName.Length > maxApplicationNameSize)\n        {\n            normalizedApplicationName = normalizedApplicationName[..maxApplicationNameSize];\n        }\n\n        // Run mode always includes random suffix for uniqueness\n        return $\"{prefix}-{normalizedApplicationName}-{suffix}\";\n    }\n\n    public async Task<bool> EnsureProvisioningOptionsAsync(bool forcePrompt, CancellationToken cancellationToken = default)\n    {\n        await RehydrateProvisioningOptionsAsync(cancellationToken).ConfigureAwait(false);\n\n        if (!_interactionService.IsAvailable)\n        {\n            if (forcePrompt)\n            {\n                throw new MissingConfigurationException(\"Azure provisioning options can't be changed because the interaction service is unavailable.\");\n            }\n\n            return HasProvisioningOptions();\n        }\n\n        if (!forcePrompt && HasProvisioningOptions())\n        {\n            return true;\n        }\n\n        await _provisioningOptionsLock.WaitAsync(cancellationToken).ConfigureAwait(false);\n\n        try\n        {\n            await RehydrateProvisioningOptionsAsync(cancellationToken).ConfigureAwait(false);\n\n            if (!forcePrompt && HasProvisioningOptions())\n            {","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure/Provisioning/Internal/RunModeProvisioningContextProvider.cs#L59-L95","documentation":"EnsureProvisioningOptionsAsync prompts the user for Azure provisioning options (subscription, resource group) through the app host's interaction service (dashboard prompt). When the interaction service is unavailable (headless/non-interactive run, no dashboard) and forcePrompt was requested, prompting is impossible, so a MissingConfigurationException is thrown. Without forcePrompt the method degrades gracefully and just reports whether options exist.","triggerScenarios":"Calling EnsureProvisioningOptionsAsync(forcePrompt: true) in an environment where IInteractionService.IsAvailable is false — e.g. running the AppHost headless (no dashboard/browser interaction), in CI, or with the dashboard disabled — and no complete options are already persisted.","commonSituations":"Developers hit this running aspire/dotnet run in a headless terminal or CI pipeline where no dashboard UI can render the prompt, while a code path (or dashboard 'edit options' command) forces re-prompting.","solutions":["Provide the options non-interactively before running: set AZURE_SUBSCRIPTION_ID and related Azure provisioning environment variables, or supply saved deployment state.","Don't force prompting in headless environments; pass forcePrompt: false and rely on pre-supplied options.","Run the AppHost with the dashboard/interaction service available (interactive environment) when prompting is required.","Pre-create a resource group and persist provisioning options so HasProvisioningOptions() returns true without prompting."],"exampleFix":"// before\nawait provider.EnsureProvisioningOptionsAsync(forcePrompt: true); // headless CI -> throws\n// after\nEnvironment.SetEnvironmentVariable(\"AZURE_SUBSCRIPTION_ID\", subscriptionId);\nvar available = await provider.EnsureProvisioningOptionsAsync(forcePrompt: false); // no prompt; uses env/persisted options","handlingStrategy":"fallback","validationCode":"if (forcePrompt && !interactionService.IsAvailable)\n{\n    // supply options via env/deployment state instead of prompting\n    Environment.SetEnvironmentVariable(\"AZURE_SUBSCRIPTION_ID\", subscriptionId);\n}\n","typeGuard":"bool CanPrompt(IInteractionService interactionService) => interactionService.IsAvailable;","tryCatchPattern":"try\n{\n    await provider.EnsureProvisioningOptionsAsync(forcePrompt: true, ct);\n}\ncatch (MissingConfigurationException ex) when (ex.Message.Contains(\"interaction service is unavailable\"))\n{\n    // fall back to env vars / persisted provisioning options instead of prompting\n}","preventionTips":["In headless/CI environments always provision AZURE_SUBSCRIPTION_ID (and related options) via environment or saved deployment state.","Use forcePrompt: false when no interactive UI is available.","Only force prompting in sessions where the dashboard/interaction service is running."],"tags":["azure","provisioning","headless","interactive","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"}