Skip to content

Register Microsoft.KeyVault provider before Key Vault creation#12

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-missing-subscription-registration
Draft

Register Microsoft.KeyVault provider before Key Vault creation#12
Copilot wants to merge 2 commits intomainfrom
copilot/fix-missing-subscription-registration

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 16, 2026

Deployments fail with MissingSubscriptionRegistration when the subscription hasn't registered the Microsoft.KeyVault resource provider.

  • Added _register_keyvault_provider() to PrerequisitesRoutes — runs az provider register --namespace Microsoft.KeyVault --wait before keyvault creation
  • Called in both deploy() and ensure_keyvault_ready() paths, gating _create_keyvault()
  • On failure, aborts early with a provider_registration step in the response
async def _register_keyvault_provider(self, steps: list[dict]) -> bool:
    ok, msg = await run_sync(
        self._az.ok,
        "provider", "register", "--namespace", "Microsoft.KeyVault", "--wait",
    )
    steps.append({
        "step": "provider_registration",
        "status": "ok" if ok else "failed",
        "detail": "Microsoft.KeyVault registered" if ok else (msg or "Unknown error"),
    })
    return ok
Original prompt

This section details on the original issue you should resolve

<issue_title>MissingSubscriptionRegistration issue</issue_title>
<issue_description>Exception Details:\t(MissingSubscriptionRegistration) The subscription is not registered to use namespace 'Microsoft.KeyVault'.</issue_description>

<agent_instructions>please ensure that keyvault registration is done as part of deployment option</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Add _register_keyvault_provider() to PrerequisitesRoutes that calls
`az provider register --namespace Microsoft.KeyVault --wait` before
attempting keyvault creation. This prevents the
MissingSubscriptionRegistration error when the subscription hasn't
registered the Microsoft.KeyVault resource provider.

The registration step is added to both deploy() and
ensure_keyvault_ready() code paths.

Co-authored-by: aymenfurter <20464460+aymenfurter@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing subscription registration issue for KeyVault Register Microsoft.KeyVault provider before Key Vault creation Mar 16, 2026
Copilot AI requested a review from aymenfurter March 16, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MissingSubscriptionRegistration issue

2 participants