Azure Logic Apps Management Client Library
This is the Microsoft Azure Logic Apps Management Client Library for Python. It provides programmatic access to manage Azure Logic Apps, enabling users to create, update, and delete automated workflows that integrate various applications, data, services, and on-premises systems. The library is currently at version 10.0.0 and is part of the broader Azure SDK for Python, which follows a continuous release cadence.
Warnings
- breaking Version 10.0.0 (and its beta 9.0.0b1) introduced significant breaking changes in the credential system. Old `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported. The `credentials` parameter was renamed to `credential`, and the `config` attribute was removed from clients.
- breaking The return type for Long-Running Operations (LROs) changed. Operations that used to return a `msrest.polling.LROPoller` now return an `azure.core.polling.LROPoller`.
- breaking The exception hierarchy has been simplified. Most service-related exceptions are now `azure.core.exceptions.HttpResponseError`, replacing older `CloudError` types.
- gotcha Python 2.7 support has ended as of January 2022. The `azure-mgmt-logic` library versions 3.6+ are officially supported. The latest client libraries generally recommend Python 3.9+.
- gotcha Asynchronous (async) clients are available for this library and are located in the `aio` namespace (e.g., `azure.mgmt.logic.aio.LogicManagementClient`). These require `async`/`await` syntax.
Install
-
pip install azure-mgmt-logic
Imports
- LogicManagementClient
from azure.mgmt.logic import LogicManagementClient
- DefaultAzureCredential
from azure.identity import DefaultAzureCredential
- ServicePrincipalCredentials
Quickstart
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.logic import LogicManagementClient
# It's recommended to set these environment variables:
# AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_SUBSCRIPTION_ID
# for DefaultAzureCredential to automatically pick them up.
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "<your-subscription-id>")
try:
# Authenticate using DefaultAzureCredential
# This will attempt various authentication methods, including environment variables.
credential = DefaultAzureCredential()
# Create a LogicManagementClient
logic_client = LogicManagementClient(credential, subscription_id)
print(f"Listing Integration Accounts in subscription: {subscription_id}")
# List all Integration Accounts within the subscription
# Integration Accounts are often used with Logic Apps for B2B scenarios.
integration_accounts = logic_client.integration_accounts.list_by_subscription()
found_accounts = False
for account in integration_accounts:
print(f"- Name: {account.name}, Location: {account.location}, Resource Group: {account.id.split('/')[4]}")
found_accounts = True
if not found_accounts:
print("No Integration Accounts found in this subscription. (This is normal for new subscriptions)")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure your Azure environment variables (e.g., AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_SUBSCRIPTION_ID) are set correctly and you have the necessary permissions.")