Skip to content

Azure/connectors-python-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

123 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

CI PyPI version Python versions License: MIT

Azure Connectors Python SDK

Type-safe Python clients for Azure connectors β€” call Office 365, SharePoint, Teams, Dataverse, and 1,000+ connectors directly from Azure Functions and other Python apps.

Caution

Early Preview β€” Not for Production Use

This SDK is currently in early preview and is under active development. It is intended for evaluation, experimentation, and feedback purposes only.

  • Do not use this SDK in production environments.
  • Breaking changes should be expected across APIs, data models, and behavior in future releases.
  • Features may be added, modified, or removed without prior notice.

We welcome feedback and contributions β€” please open an issue with questions, suggestions, or bug reports.

Why This SDK?

Azure provides a rich ecosystem of managed connectors that bridge your code to SaaS services, PaaS resources, and on-premises systems. Originally powering Azure Logic Apps and Power Automate, these connectors are now available as standalone, strongly-typed Python clients for any Python application β€” no workflow service required.

  • Async/await native β€” Built on aiohttp with full async support for modern Python applications
  • Type-safe operations β€” Generated async methods with type hints and comprehensive docstrings
  • Built-in authentication β€” Managed identity, Azure Identity, and API key token providers
  • Resilient HTTP β€” Configurable retry policies with exponential backoff for transient failures
  • 1,000+ connectors β€” Any Azure managed connector available via API Hub can be generated

Note: This is the Python SDK. A .NET SDK is also available. Node.js and Java SDKs are planned in collaboration with the Azure Functions team.

How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Your Azure Function / Python App   β”‚
β”‚                                     β”‚
β”‚  async with Office365Client(...):   β”‚
β”‚      await client.send_email(...)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Generated Connector Clients       β”‚
β”‚   (office365.py, teams.py, etc.)    β”‚
β”‚                                     β”‚
β”‚  β€’ Typed async methods per action   β”‚
β”‚  β€’ Dataclass models from Swagger    β”‚
β”‚  β€’ Docstrings from connector meta   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ depends on
               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Azure Connectors Python SDK       β”‚
β”‚   azure.connectors.sdk              β”‚
β”‚                                     β”‚
β”‚  β€’ ManagedIdentityTokenProvider     β”‚
β”‚  β€’ ConnectorHttpClient + retry      β”‚
β”‚  β€’ ConnectorClientBase              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Installation

Install from PyPI:

pip install azure-connectors

Or install with development dependencies:

pip install azure-connectors[dev]

Quick Start

Example: Send an email with Office 365

import asyncio
from azure.connectors.office365 import Office365Client
from azure.connectors.sdk import ManagedIdentityTokenProvider

async def send_email_example():
    # Connection runtime URL from Azure Portal
    connection_url = "https://example.azure.com/connections/office365"
    
    # Use managed identity for authentication
    token_provider = ManagedIdentityTokenProvider()
    
    # Create client and send email
    async with Office365Client(connection_url, token_provider) as client:
        await client.send_email_v2_async(
            to="recipient@example.com",
            subject="Hello from Python SDK",
            body="<p>This email was sent using the Azure Connectors Python SDK!</p>",
            from_address="sender@example.com"
        )
    
    print("Email sent successfully!")

# Run the async function
asyncio.run(send_email_example())

Example: List SharePoint items

from azure.connectors.sharepointonline import SharepointonlineClient

async def list_sharepoint_items():
    connection_url = "https://example.azure.com/connections/sharepointonline"
    
    async with SharepointonlineClient(connection_url) as client:
        # Get all items from a SharePoint list
        items = await client.get_items_async(
            dataset="https://contoso.sharepoint.com/sites/MySite",
            table="MyList"
        )
        
        for item in items.get("value", []):
            print(f"Item: {item.get('Title')}")

asyncio.run(list_sharepoint_items())

Example: Post a Teams message

from azure.connectors.teams import TeamsClient

async def post_teams_message():
    connection_url = "https://example.azure.com/connections/teams"
    
    async with TeamsClient(connection_url) as client:
        await client.post_message_to_conversation_async(
            group_id="team-group-id",
            channel_id="19:channel-id",
            body_content="Hello from Python!",
            body_content_type="text"
        )
    
    print("Message posted to Teams!")

asyncio.run(post_teams_message())

Validated Connectors

The following connectors have been generated and validated with comprehensive test coverage:

Connector Package Status Coverage Tests
ARM (Azure Resource Manager) azure.connectors.arm βœ… Complete πŸ”„ SDK Generated 39 tests
Azure Automation azure.connectors.azureautomation βœ… Complete πŸ”„ SDK Generated 32 tests
Azure AD azure.connectors.azuread βœ… Complete πŸ”„ SDK Generated 35 tests
Azure Blob Storage azure.connectors.azureblob βœ… Complete βœ… E2E Validated 52 tests
Azure Cosmos DB azure.connectors.documentdb βœ… Complete πŸ”„ SDK Generated 46 tests
Azure Data Factory azure.connectors.azuredatafactory βœ… Complete πŸ”„ SDK Generated 38 tests
Azure Digital Twins azure.connectors.azuredigitaltwins βœ… Complete πŸ”„ SDK Generated 44 tests
Azure Data Explorer azure.connectors.kusto βœ… Complete βœ… E2E Validated 37 tests
Azure Event Hubs azure.connectors.eventhubs βœ… Complete πŸ”„ SDK Generated 30 tests
Azure Key Vault azure.connectors.keyvault βœ… Complete πŸ”„ SDK Generated 42 tests
Azure Queues azure.connectors.azurequeues βœ… Complete πŸ”„ SDK Generated 34 tests
Azure Tables azure.connectors.azuretables βœ… Complete πŸ”„ SDK Generated 43 tests
Azure VM azure.connectors.azurevm βœ… Complete πŸ”„ SDK Generated 43 tests
Excel Online (Business) azure.connectors.excelonlinebusiness βœ… Complete πŸ”„ SDK Generated 37 tests
IBM MQ azure.connectors.mq βœ… Complete βœ… E2E Validated 30 tests
Microsoft Bookings azure.connectors.microsoftbookings βœ… Complete πŸ”„ SDK Generated 36 tests
Microsoft Dataverse azure.connectors.commondataservice βœ… Complete πŸ”„ SDK Generated 46 tests
Microsoft Defender ATP azure.connectors.wdatp βœ… Complete πŸ”„ SDK Generated 32 tests
Microsoft Graph azure.connectors.msgraphgroupsanduser βœ… Complete βœ… E2E Validated 46 tests
Microsoft Teams azure.connectors.teams βœ… Complete βœ… E2E Validated 27 tests
Office 365 Outlook azure.connectors.office365 βœ… Complete βœ… E2E Validated 41 tests
Office 365 Users azure.connectors.office365users βœ… Complete βœ… E2E Validated 40 tests
Office 365 Groups azure.connectors.office365groups βœ… Complete πŸ”„ SDK Generated 50 tests
OneDrive for Business azure.connectors.onedrive βœ… Complete πŸ”„ SDK Generated 41 tests
OneNote azure.connectors.onenote βœ… Complete πŸ”„ SDK Generated 60 tests
Outlook.com azure.connectors.outlook βœ… Complete πŸ”„ SDK Generated 42 tests
Planner azure.connectors.planner βœ… Complete πŸ”„ SDK Generated 66 tests
Service Bus azure.connectors.servicebus βœ… Complete πŸ”„ SDK Generated 37 tests
SharePoint Online azure.connectors.sharepointonline βœ… Complete βœ… E2E Validated 44 tests
SMTP azure.connectors.smtp βœ… Complete πŸ”„ SDK Generated 27 tests
Word Online (Business) azure.connectors.wordonlinebusiness βœ… Complete πŸ”„ SDK Generated 30 tests
Yammer azure.connectors.yammer βœ… Complete πŸ”„ SDK Generated 38 tests

Total: 685 connector tests + 110 SDK component tests

See ROADMAP.md for planned connector additions and tests/README.md for detailed test coverage.

Authentication

The SDK supports multiple authentication methods:

Managed Identity (Recommended for Azure)

from azure.connectors.sdk import ManagedIdentityTokenProvider

# System-assigned managed identity
token_provider = ManagedIdentityTokenProvider()

# User-assigned managed identity
token_provider = ManagedIdentityTokenProvider(client_id="your-client-id")

Azure Identity Credentials

from azure.identity.aio import DefaultAzureCredential
from azure.connectors.office365 import Office365Client

# Use any Azure Identity credential directly
credential = DefaultAzureCredential()
client = Office365Client(connection_url, credential)

Connection String / API Key

from azure.connectors.sdk import ConnectionStringTokenProvider

token_provider = ConnectionStringTokenProvider("your-api-key")

Configuration Options

Customize client behavior with ConnectorClientOptions:

from azure.connectors.sdk import ConnectorClientOptions

options = ConnectorClientOptions(
    timeout_seconds=60.0,              # Request timeout
    max_retry_attempts=5,              # Max retry count
    use_exponential_backoff=True,      # Exponential backoff
    initial_retry_delay_seconds=1.0    # Initial retry delay
)

client = Office365Client(connection_url, token_provider, options)

Project Structure

azure-connectors/
β”œβ”€β”€ src/azure/connectors/
β”‚   β”œβ”€β”€ sdk/                    # Core SDK infrastructure
β”‚   β”‚   β”œβ”€β”€ authentication.py   # Token providers
β”‚   β”‚   β”œβ”€β”€ client_base.py      # Base connector client
β”‚   β”‚   β”œβ”€β”€ http_client.py      # HTTP client with retry
β”‚   β”‚   β”œβ”€β”€ options.py          # Configuration options
β”‚   β”‚   └── exceptions.py       # Exception types
β”‚   β”œβ”€β”€ office365.py            # Office 365 generated client
β”‚   β”œβ”€β”€ sharepointonline.py     # SharePoint generated client
β”‚   β”œβ”€β”€ teams.py                # Teams generated client
β”‚   β”œβ”€β”€ kusto.py                # Kusto generated client
β”‚   └── msgraph.py              # MS Graph generated client
β”œβ”€β”€ tests/                      # Comprehensive test suite
β”œβ”€β”€ samples/                    # Usage examples
└── docs/                       # Additional documentation

SDK-Type Bindings for Azure Functions

The SDK supports SDK-type bindings for Python Function apps, allowing functions to bind to and return rich, strongly-typed objects instead of raw JSON payloads. This enables cleaner code and better IDE support with type hints.

Example: Parsing Email Messages

Use the from_json class method to convert JSON payloads into typed objects:

from azure.connectors.office365 import ClientReceiveMessage

# Parse JSON payload into a list of typed email message objects
messages = ClientReceiveMessage.from_json(payload)

for message in messages:
    print(f"From: {message.from_}")
    print(f"Subject: {message.subject}")
    print(f"Importance: {message.importance}")  # 0=Low, 1=Normal, 2=High

The from_json method handles:

  • JSON string or dictionary input
  • Nested body.value payload structure
  • Field name conversion (camelCase β†’ snake_case)
  • Type conversion (e.g., importance string β†’ int)
  • Attachment parsing

Note: The from_json method is not auto-generated by the SDK code generator. See docs/sdk-type-bindings.md for implementation details and how to add support for new types.

This feature is particularly useful when building Azure Functions that process connector webhook payloads or trigger data.

Related Projects

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot.

See CONTRIBUTING.md for detailed guidelines.

Support

For issues and questions:

See SUPPORT.md for more information.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

About

A rich Python SDK providing runtime components for typed Azure connector clients.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors