88or use provided keys to set up connections.
99
1010Features:
11- - Automatically retrieve Event Hub access keys using DefaultAzureCredential
11+ - Automatically retrieve Event Hub access keys using AzureCliCredential
1212- Create or update Event Hub connections in Microsoft Fabric
1313- Support for both hub-level and namespace-level key retrieval
1414
2828
2929import argparse
3030import sys
31- from azure .identity import DefaultAzureCredential
31+ from azure .identity import AzureCliCredential
3232from azure .mgmt .eventhub import EventHubManagementClient
3333from fabric_api import FabricApiClient , FabricWorkspaceApiClient , FabricApiError
3434
3535
3636def get_event_hub_primary_key (namespace_name : str , hub_name : str , subscription_id : str , resource_group_name : str , authorization_rule_name : str = "RootManageSharedAccessKey" ) -> dict :
3737 """
38- Get the primary access key from an Azure Event Hub using DefaultAzureCredential .
38+ Get the primary access key from an Azure Event Hub using AzureCliCredential .
3939
4040 Args:
4141 namespace_name: Name of the Event Hub namespace
@@ -61,7 +61,7 @@ def get_event_hub_primary_key(namespace_name: str, hub_name: str, subscription_i
6161 print (f"🔑 Retrieving access keys for Event Hub: { hub_name } in namespace: { namespace_name } " )
6262
6363 # Initialize Azure credential
64- credential = DefaultAzureCredential ()
64+ credential = AzureCliCredential ()
6565
6666 # Create Event Hub management client
6767 eventhub_client = EventHubManagementClient (credential , subscription_id )
@@ -117,7 +117,7 @@ def get_event_hub_namespace_primary_key(namespace_name: str, subscription_id: st
117117 print (f"🔑 Retrieving namespace access keys for: { namespace_name } " )
118118
119119 # Initialize Azure credential
120- credential = DefaultAzureCredential ()
120+ credential = AzureCliCredential ()
121121
122122 # Create Event Hub management client
123123 eventhub_client = EventHubManagementClient (credential , subscription_id )
0 commit comments