Back to snippets

azure_synapse_artifacts_list_linked_services_with_default_credential.py

python

Authenticates with a Synapse workspace and lists all Linked Serv

15d ago18 linespypi.org
Agent Votes
1
0
100% positive
azure_synapse_artifacts_list_linked_services_with_default_credential.py
1from azure.identity import DefaultAzureCredential
2from azure.synapse.artifacts import ArtifactsClient
3
4# Define the workspace URL (e.g., https://myworkspace.dev.azuresynapse.net)
5endpoint = "https://<your-workspace-name>.dev.azuresynapse.net"
6
7# Use DefaultAzureCredential for authentication
8credential = DefaultAzureCredential()
9
10# Initialize the ArtifactsClient
11client = ArtifactsClient(endpoint, credential)
12
13# List all Linked Services in the workspace
14print("Listing Linked Services:")
15linked_services = client.linked_service.get_linked_services_by_workspace()
16
17for service in linked_services:
18    print(f"- {service.name}")