Skip to content

Commit 2c10a67

Browse files
Merge pull request #23 from microsoft/psl-auth-fix
fix: Replace DefaultAzureCredential with AzureCliCredential for Cloud…
2 parents 3e81939 + 615a1f9 commit 2c10a67

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

docs/FabricDataIngestion.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ The script expects these CSV files in the data directory:
7777

7878
## Authentication
7979

80-
Uses `DefaultAzureCredential` for authentication. Ensure you're authenticated via:
80+
Uses `AzureCliCredential` for authentication. Ensure you're authenticated via:
8181
- Azure CLI: `az login`
8282
- Managed Identity
8383
- Environment variables

infra/scripts/fabric/fabric_data_ingester.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from datetime import datetime, timezone
22
import os
3-
from azure.identity import DefaultAzureCredential
3+
from azure.identity import AzureCliCredential
44
from azure.kusto.data import KustoConnectionStringBuilder, KustoClient
55
from azure.kusto.data.exceptions import KustoServiceError
66
from azure.kusto.ingest import QueuedIngestClient, IngestionProperties
@@ -10,7 +10,7 @@
1010

1111
def create_kusto_client(cluster_uri: str):
1212
try:
13-
credential = DefaultAzureCredential()
13+
credential = AzureCliCredential()
1414
kcsb = KustoConnectionStringBuilder.with_azure_token_credential(cluster_uri, credential)
1515
client = KustoClient(kcsb)
1616
return client
@@ -23,7 +23,7 @@ def create_kusto_client(cluster_uri: str):
2323
def create_ingestion_client(cluster_uri: str):
2424
try:
2525
print(f"Connecting to Fabric cluster: {cluster_uri}")
26-
credential = DefaultAzureCredential()
26+
credential = AzureCliCredential()
2727

2828
# Create ingestion client using the ingestion endpoint
2929
# The ingestion URI is typically the cluster URI with 'ingest-' prefix

infra/scripts/fabric/fabric_database.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
scripts_dir = script_dir.parent
2525
sys.path.insert(0, str(scripts_dir))
2626

27-
from azure.identity import DefaultAzureCredential
27+
from azure.identity import AzureCliCredential
2828
from azure.kusto.data import KustoClient, KustoConnectionStringBuilder, ClientRequestProperties
2929
from azure.kusto.data.exceptions import KustoServiceError
3030

@@ -45,7 +45,7 @@ def create_kusto_client(cluster_uri) -> KustoClient:
4545
try:
4646

4747
print(f"Connecting to Fabric cluster: {cluster_uri}")
48-
credential = DefaultAzureCredential()
48+
credential = AzureCliCredential()
4949
kcsb = KustoConnectionStringBuilder.with_azure_token_credential(cluster_uri, credential)
5050
client = KustoClient(kcsb)
5151
print(f"✅ Connected to Fabric cluster")

infra/scripts/fabric/fabric_eventhub.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
or use provided keys to set up connections.
99
1010
Features:
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
@@ -28,14 +28,14 @@
2828

2929
import argparse
3030
import sys
31-
from azure.identity import DefaultAzureCredential
31+
from azure.identity import AzureCliCredential
3232
from azure.mgmt.eventhub import EventHubManagementClient
3333
from fabric_api import FabricApiClient, FabricWorkspaceApiClient, FabricApiError
3434

3535

3636
def 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)

src/simulator/event_hub_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
try:
44
from azure.eventhub import EventHubProducerClient, EventData
5-
from azure.identity import DefaultAzureCredential
5+
from azure.identity import AzureCliCredential
66
except ImportError:
77
print("❌ Error: azure-eventhub and azure-identity packages are required.")
88
print("Install them using: pip install azure-eventhub azure-identity")
@@ -12,7 +12,7 @@ class EventHubService:
1212
def __init__(self, fully_qualified_namespace: str, event_hub_name: str):
1313
self.fully_qualified_namespace = fully_qualified_namespace
1414
self.event_hub_name = event_hub_name
15-
self.credential = DefaultAzureCredential()
15+
self.credential = AzureCliCredential()
1616

1717
def send_event(self, data: object):
1818
producer = EventHubProducerClient(

0 commit comments

Comments
 (0)