Skip to content

Connections

Listing Connections

import fabias

fabias.client(auth=my_auth)

for conn in fabias.connections():
    print(f"{conn.name}: {conn.connectivityType}")

Getting a Connection

# By name
conn = fabias.connection("SQL Server Prod")

# By GUID
conn = fabias.connection("connection-guid")

Creating Connections

import fabias
from fabias import ConnectivityType

new_conn = fabias.connections.add(
    displayName="New SQL Connection",
    connectionType="Sql",
    connectivityType=ConnectivityType.CLOUD
)

Connection Types

  • Cloud: Direct cloud-to-cloud connectivity
  • VirtualNetworkGateway: Via Azure VNet gateway
  • OnPremisesGateway: Via on-premises data gateway

Role Assignments

conn = fabias.connection("SQL Server")

# List role assignments
for assignment in conn.roleAssignments():
    print(f"{assignment.principalId}: {assignment.role}")

# Add a role assignment
conn.roleAssignments.add(
    principalId="user-guid",
    principalType="User",
    role="User"
)

# Remove a role assignment
conn.roleAssignments.delete("user-guid")

Connection Properties

conn = fabias.connection("SQL Server")

print(f"Name: {conn.name}")
print(f"ID: {conn.id}")
print(f"Type: {conn.connectionType}")
print(f"Connectivity: {conn.connectivityType}")
print(f"Privacy Level: {conn.privacyLevel}")