Azure Synapse Management

2.0.0 · active · verified Thu Apr 09

The Microsoft Azure Synapse Management Client Library for Python (azure-mgmt-synapse) provides the necessary tools to manage Azure Synapse Analytics workspaces, SQL pools, Apache Spark pools, and integration runtimes. It enables programmatic control over Synapse resources within an Azure subscription. The library is currently at version 2.0.0 (released April 2021) and adheres to the standard Azure SDK guidelines, offering a stable interface for managing Synapse services.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to authenticate with Azure using `DefaultAzureCredential` and then list all Azure Synapse workspaces within a specified subscription using `SynapseManagementClient`.

import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.synapse import SynapseManagementClient

# Set the AZURE_SUBSCRIPTION_ID environment variable or replace with your actual subscription ID
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "<your-subscription-id>")

if subscription_id == "<your-subscription-id>":
    raise ValueError("Please set the AZURE_SUBSCRIPTION_ID environment variable or provide your subscription ID.")

# Authenticate using DefaultAzureCredential, which handles various Azure authentication methods.
# For local development, ensure you are logged in via Azure CLI (`az login`)
# or have appropriate environment variables set.
credential = DefaultAzureCredential()

# Create a SynapseManagementClient
client = SynapseManagementClient(credential, subscription_id)

print("Listing Synapse Workspaces:")
# Iterate over the workspaces in your subscription
for workspace in client.workspaces.list():
    print(f"- {workspace.name} (Location: {workspace.location})")

view raw JSON →