Fix: fail fast on missing Event Hub key in Fabric connection setup#62
Draft
Fix: fail fast on missing Event Hub key in Fabric connection setup#62
Conversation
…tion Agent-Logs-Url: https://github.com/microsoft/real-time-intelligence-operations-solution-accelerator/sessions/8e4a1c2b-b566-4dd9-914d-8fa732f98757 Co-authored-by: Yatish-Microsoft <[email protected]>
Copilot
AI
changed the title
[WIP] Fix GitHub Actions failure during Event Hub connection setup
Fix: fail fast on missing Event Hub key in Fabric connection setup
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
setup_eventhub_connectionwas silently forwarding empty/invalid credentials to the Fabric API, producing a misleading400 IncorrectCredentials / AccessUnauthorizedinstead of a clear root-cause error whenlistKeysRBAC is absent.Changes
import osadded to support env var lookup.AZURE_EVENT_HUB_SHARED_ACCESS_KEYenv override — if set and non-empty, the value is used directly, bypassing thelist_keysmanagement API call entirely. Useful in CI where the deployment identity lackslistKeysRBAC.get_event_hub_namespace_primary_keycall in an innertry/except; on failure raisesRuntimeErrorwith an actionable message pointing at either the env var or the required RBAC action (Microsoft.EventHub/namespaces/authorizationRules/listKeys/action).RuntimeErrorif not, preventing a bad credential from ever reaching the Fabric API.get_event_hub_namespace_primary_keyto include the namespace name.Original prompt
Create a PR against branch
devinmicrosoft/real-time-intelligence-operations-solution-acceleratorto fix the GitHub Actions failure in run https://github.com/microsoft/real-time-intelligence-operations-solution-accelerator/actions/runs/23593084340/job/69513123026.Context
The workflow
.github/workflows/azure-dev.ymlondevfails during Fabric provisioning when creating an Event Hub connection.Job logs show the failure on 2026-04-01 with Fabric API POST
https://api.fabric.microsoft.com/v1/connectionsreturning HTTP 400IncorrectCredentialswith inner messageAccessUnauthorized, and the script failing in operationsetup_eventhub_connection.Relevant code (on
dev) is ininfra/scripts/fabric/fabric_eventhub.pyat commit829e578f31a505646dfc2bd5d66eb2cdcb692dfd(ref from job logs).setup_eventhub_connection()currently:get_event_hub_namespace_primary_key(...)key_info['primary_key']without validationcreate_eventhub_connection/update_eventhub_connectionusing that keyDesired changes
Make the provisioning more robust and avoid pushing bad/empty credentials to Fabric:
Update
infra/scripts/fabric/fabric_eventhub.py:AZURE_EVENT_HUB_SHARED_ACCESS_KEY). If set and non-empty, use it instead of calling Azure managementlist_keys.get_event_hub_namespace_primary_key).access_keyis non-empty/whitespace.access_keyis missing/empty, raise aRuntimeErrorwith a clear diagnostic message that explains either:AZURE_EVENT_HUB_SHARED_ACCESS_KEY, orMicrosoft.EventHub/namespaces/authorizationRules/listKeys/action).Do NOT change the workflow in this PR (user asked: "no issue right" and did not request workflow/secret changes). Keep it code-only.
Acceptance criteria
setup_eventhub_connectionuses env var override when present.Notes
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The job is failing in the
azd uppostprovision hook when the Fabric provisioning Python script tries to create a Microsoft Fabric connection to Event Hub:setup_eventhub_connectionPOST https://api.fabric.microsoft.com/v1/connectionsIncorrectCredentialswith inner messageAccessUnauthorizedpostprovision hook failed with exit code: 1(Python script exits 1)This is not a checkout/runner issue; it’s an authentication/authorization problem for the credentials being used to establish the Event Hub connection inside Fabric.
What’s happening
Your workflow (
.github/workflows/azure-dev.ymlat ref829e578f31a505646dfc2bd5d66eb2cdcb692dfd) successfully:azure/login@v2)azdusing federated GitHub credentialsazd upThen
azure.yamlruns this hook:Inside
deploy_fabric_rti.py, the step that creates the Fabric Event Hub connection is providing credentials that Fabric rejects (IncorrectCredentials/AccessUnauthorized).In practice, this usually means one (or more) of the following:
This pull request was created from Copilot chat.