Microsoft Azure Synapse Management Client Library for Python
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Core Synapse workspace lifecycle management including creation, configuration, monitoring, and administrative operations. Workspaces serve as the top-level container for all Synapse resources and provide the foundation for data integration, analytics, and machine learning workflows.
Fundamental workspace management operations including creation, retrieval, updates, and deletion.
def get(resource_group_name: str, workspace_name: str) -> Workspace:
"""
Get a workspace.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
Returns:
Workspace: The workspace object
"""
def create_or_update(resource_group_name: str, workspace_name: str, workspace_info: Workspace) -> LROPoller[Workspace]:
"""
Create or update a workspace.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- workspace_info (Workspace): Workspace properties
Returns:
LROPoller[Workspace]: Long-running operation poller
"""
def delete(resource_group_name: str, workspace_name: str) -> LROPoller[object]:
"""
Delete a workspace.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
Returns:
LROPoller[object]: Long-running operation poller
"""
def update(resource_group_name: str, workspace_name: str, workspace_patch_info: WorkspacePatchInfo) -> LROPoller[Workspace]:
"""
Update workspace properties.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- workspace_patch_info (WorkspacePatchInfo): Update parameters
Returns:
LROPoller[Workspace]: Long-running operation poller
"""Operations to list and discover workspaces across resource groups and subscriptions.
def list_by_resource_group(resource_group_name: str) -> ItemPaged[Workspace]:
"""
List workspaces in a resource group.
Parameters:
- resource_group_name (str): Name of the resource group
Returns:
ItemPaged[Workspace]: Paged collection of workspaces
"""
def list_by_subscription() -> ItemPaged[Workspace]:
"""
List workspaces in a subscription.
Returns:
ItemPaged[Workspace]: Paged collection of workspaces
"""Administrative operations for workspace management including Azure AD integration and managed identity configuration.
def get_aad_admin(resource_group_name: str, workspace_name: str) -> WorkspaceAadAdminInfo:
"""
Get workspace Azure AD administrator.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
Returns:
WorkspaceAadAdminInfo: Azure AD admin information
"""
def create_or_update_aad_admin(resource_group_name: str, workspace_name: str, aad_admin_info: WorkspaceAadAdminInfo) -> LROPoller[WorkspaceAadAdminInfo]:
"""
Set workspace Azure AD administrator.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- aad_admin_info (WorkspaceAadAdminInfo): Azure AD admin configuration
Returns:
LROPoller[WorkspaceAadAdminInfo]: Long-running operation poller
"""
def delete_aad_admin(resource_group_name: str, workspace_name: str) -> LROPoller[object]:
"""
Remove workspace Azure AD administrator.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
Returns:
LROPoller[object]: Long-running operation poller
"""SQL-specific Azure AD administrator management for workspace SQL pools.
def get_sql_aad_admin(resource_group_name: str, workspace_name: str) -> WorkspaceAadAdminInfo:
"""
Get workspace SQL Azure AD administrator.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
Returns:
WorkspaceAadAdminInfo: SQL Azure AD admin information
"""
def create_or_update_sql_aad_admin(resource_group_name: str, workspace_name: str, aad_admin_info: WorkspaceAadAdminInfo) -> LROPoller[WorkspaceAadAdminInfo]:
"""
Set workspace SQL Azure AD administrator.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- aad_admin_info (WorkspaceAadAdminInfo): SQL Azure AD admin configuration
Returns:
LROPoller[WorkspaceAadAdminInfo]: Long-running operation poller
"""
def delete_sql_aad_admin(resource_group_name: str, workspace_name: str) -> LROPoller[object]:
"""
Remove workspace SQL Azure AD administrator.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
Returns:
LROPoller[object]: Long-running operation poller
"""Configure managed identity access control for SQL operations within the workspace.
def get_managed_identity_sql_control_settings(resource_group_name: str, workspace_name: str) -> ManagedIdentitySqlControlSettingsModel:
"""
Get managed identity SQL control settings.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
Returns:
ManagedIdentitySqlControlSettingsModel: Managed identity SQL control settings
"""
def create_or_update_managed_identity_sql_control_settings(resource_group_name: str, workspace_name: str, managed_identity_sql_control_settings: ManagedIdentitySqlControlSettingsModel) -> LROPoller[ManagedIdentitySqlControlSettingsModel]:
"""
Set managed identity SQL control settings.
Parameters:
- resource_group_name (str): Name of the resource group
- workspace_name (str): Name of the workspace
- managed_identity_sql_control_settings (ManagedIdentitySqlControlSettingsModel): Settings configuration
Returns:
LROPoller[ManagedIdentitySqlControlSettingsModel]: Long-running operation poller
"""class Workspace:
"""
A workspace.
Attributes:
- id (str): Resource ID
- name (str): Resource name
- type (str): Resource type
- location (str): Resource location
- tags (dict): Resource tags
- identity (ManagedIdentity): Managed identity configuration
- default_data_lake_storage (DataLakeStorageAccountDetails): Default storage account
- sql_administrator_login_password (str): SQL admin password
- managed_virtual_network (str): Managed virtual network name
- connectivity_endpoints (dict): Service connectivity endpoints
- managed_resource_group_name (str): Managed resource group name
- provisioning_state (str): Provisioning state
- encryption (EncryptionDetails): Encryption configuration
- workspace_uid (str): Workspace unique identifier
- extra_properties (dict): Additional properties
- managed_virtual_network_settings (ManagedVirtualNetworkSettings): VNet settings
- workspace_repository_configuration (WorkspaceRepositoryConfiguration): Git repo config
- purview_configuration (PurviewConfiguration): Purview integration
- adla_resource_id (str): Azure Data Lake Analytics resource ID
- public_network_access (str): Public network access setting
"""class WorkspacePatchInfo:
"""
Workspace patch properties.
Attributes:
- tags (dict): Resource tags
- identity (ManagedIdentity): Managed identity configuration
- sql_administrator_login_password (str): SQL admin password
- managed_virtual_network_settings (ManagedVirtualNetworkSettings): VNet settings
- workspace_repository_configuration (WorkspaceRepositoryConfiguration): Git repo config
- purview_configuration (PurviewConfiguration): Purview integration
- public_network_access (str): Public network access setting
- encryption (EncryptionDetails): Encryption configuration
"""class WorkspaceAadAdminInfo:
"""
Workspace Azure AD administrator properties.
Attributes:
- tenant_id (str): Azure AD tenant ID
- login (str): Administrator login name
- administrator_type (str): Administrator type
- sid (str): Administrator object ID
"""class ManagedIdentitySqlControlSettingsModel:
"""
Managed identity SQL control settings.
Attributes:
- grant_sql_control_to_managed_identity (ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity): Grant settings
"""from azure.mgmt.synapse.models import (
Workspace, DataLakeStorageAccountDetails, ManagedIdentity
)
# Configure workspace properties
data_lake_storage = DataLakeStorageAccountDetails(
account_url="https://mystorageaccount.dfs.core.windows.net",
filesystem="myfilesystem"
)
identity = ManagedIdentity(type="SystemAssigned")
workspace_info = Workspace(
location="East US",
default_data_lake_storage=data_lake_storage,
sql_administrator_login="sqladmin",
sql_administrator_login_password="ComplexPassword123!",
identity=identity,
managed_resource_group_name="synapse-managed-rg"
)
# Create the workspace
operation = client.workspaces.create_or_update(
resource_group_name="my-resource-group",
workspace_name="my-synapse-workspace",
workspace_info=workspace_info
)
workspace = operation.result() # Wait for completion
print(f"Created workspace: {workspace.name}")from azure.mgmt.synapse.models import WorkspaceAadAdminInfo
aad_admin = WorkspaceAadAdminInfo(
tenant_id="your-tenant-id",
login="admin@domain.com",
administrator_type="ActiveDirectory",
sid="object-id-of-admin-user"
)
operation = client.workspace_aad_admins.create_or_update_aad_admin(
resource_group_name="my-resource-group",
workspace_name="my-synapse-workspace",
aad_admin_info=aad_admin
)
admin_info = operation.result()
print(f"Set Azure AD admin: {admin_info.login}")Install with Tessl CLI
npx tessl i tessl/pypi-azure-mgmt-synapse