{"record":{"id":"16932fa589c14502","repo":"microsoft/aspire","slug":"azure-provisioning-options-were-not-provided","errorCode":null,"errorMessage":"Azure provisioning options were not provided.","messagePattern":"Azure provisioning options were not provided\\.","errorType":"validation","errorClass":"MissingConfigurationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure/Provisioning/Internal/RunModeProvisioningContextProvider.cs","lineNumber":135,"sourceCode":"        finally\n        {\n            _provisioningOptionsLock.Release();\n        }\n    }\n\n    public override async Task<ProvisioningContext> CreateProvisioningContextAsync(CancellationToken cancellationToken = default)\n    {\n        await RehydrateProvisioningOptionsAsync(cancellationToken).ConfigureAwait(false);\n\n        var result = await EnsureProvisioningOptionsAsync(forcePrompt: false, cancellationToken).ConfigureAwait(false);\n        if (!result)\n        {\n            if (!_interactionService.IsAvailable)\n            {\n                return await base.CreateProvisioningContextAsync(cancellationToken).ConfigureAwait(false);\n            }\n\n            throw new MissingConfigurationException(\"Azure provisioning options were not provided.\");\n        }\n\n        return await base.CreateProvisioningContextAsync(cancellationToken).ConfigureAwait(false);\n    }\n\n    public async Task PersistProvisioningOptionsAsync(CancellationToken cancellationToken = default)\n    {\n        if (string.IsNullOrEmpty(_options.ResourceGroup))\n        {\n            _options.ResourceGroup = GetDefaultResourceGroupName();\n            _options.AllowResourceGroupCreation ??= true;\n        }\n\n        await SaveProvisioningOptionsAsync(_options.ResourceGroup, cancellationToken).ConfigureAwait(false);\n    }\n\n    public async Task<AzureProvisioningOptionsState> ApplyProvisioningOptionsAsync(AzureProvisioningOptionsUpdate options, CancellationToken cancellationToken = default)\n    {","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure/Provisioning/Internal/RunModeProvisioningContextProvider.cs#L117-L153","documentation":"CreateProvisioningContextAsync builds the provisioning context (subscription, tenant, resource group, principal) required to provision Azure resources. If EnsureProvisioningOptionsAsync reports that no provisioning options were provided (no subscription/resource group resolved and the user declined or never completed the prompt), the interactive path throws MissingConfigurationException since it cannot construct a context. In non-interactive mode it falls back to the base provider, which applies its own rules (e.g. environment variables).","triggerScenarios":"Calling CreateProvisioningContextAsync in run mode when the interaction service IS available but no options exist — the user cancelled the dashboard prompt, never entered a subscription id, or no persisted deployment state was found — and EnsureProvisioningOptionsAsync(forcePrompt: false) returned false.","commonSituations":"Developers hit this when they dismiss or skip the Azure subscription prompt in the dashboard the first time they run an AppHost with Azure resources, or when previously saved provisioning state was cleared/corrupted so rehydration finds nothing.","solutions":["Complete the Azure provisioning prompt in the dashboard (select subscription and resource group) instead of skipping it.","Set AZURE_SUBSCRIPTION_ID (and optionally AZURE_LOCATION) in the environment so options resolve without prompting.","Restore or recreate the deployment state file so persisted provisioning options rehydrate.","Retry the run and accept the prompt; if the prompt keeps being declined, check for dashboard UI issues blocking interaction."],"exampleFix":"// before\n// user skips the subscription prompt in dashboard, then provisioning fails\n// after\nexport AZURE_SUBSCRIPTION_ID=\"00000000-0000-0000-0000-000000000000\"\nexport AZURE_LOCATION=\"eastus\"\n# rerun: options resolve without prompting and CreateProvisioningContextAsync succeeds","handlingStrategy":"fallback","validationCode":"var optionsSet = !string.IsNullOrEmpty(options.Value.SubscriptionId) || !string.IsNullOrEmpty(options.Value.ResourceGroup);\nif (!optionsSet)\n{\n    // seed from environment before building the context\n    options.Value.SubscriptionId ??= Environment.GetEnvironmentVariable(\"AZURE_SUBSCRIPTION_ID\");\n}\n","typeGuard":"bool HasProvisioningOptions(AzureProvisionerOptions o) =>\n    !string.IsNullOrWhiteSpace(o.SubscriptionId) || !string.IsNullOrWhiteSpace(o.ResourceGroup);","tryCatchPattern":"try\n{\n    var context = await provider.CreateProvisioningContextAsync(ct);\n}\ncatch (MissingConfigurationException ex) when (ex.Message.Contains(\"options were not provided\"))\n{\n    // set AZURE_SUBSCRIPTION_ID / AZURE_LOCATION, or re-run and complete the dashboard prompt\n}","preventionTips":["Never skip/cancel the dashboard provisioning prompt on first run of an AppHost with Azure resources.","Set AZURE_SUBSCRIPTION_ID (and AZURE_LOCATION) in the environment for non-interactive runs.","Keep the deployment state file intact so persisted options rehydrate on later runs."],"tags":["azure","provisioning","options","dashboard","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"}