Registry / azure / azure-mgmt-automation

azure-mgmt-automation

JSON →
library1.0.1pypypi✓ verified 85d ago

The `azure-mgmt-automation` library provides Python APIs for managing Azure Automation resources, including Automation Accounts, Runbooks, Jobs, Schedules, and Hybrid Runbook Workers. It is part of the Azure SDK for Python (Track 2) and is currently at version 1.0.0. Azure SDKs typically follow an 'as-needed' release cadence, with updates when new service features or bug fixes are available.

pip install azure-mgmt-automation
INSTALL
IMPORT
SIG · AZURE-MGMT-AUTOMAT
A
azure-mgmt-automation
azurepythonv1.0.1
Install
2.7s avg
Import
621ms
Disk
26MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.655s · 27.4MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.7s · import 0.588s · 28MB
26MB installed
● package 26MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AutomationClient
from azure.mgmt.automation import AutomationClient
DefaultAzureCredential
from azure.identity import DefaultAzureCredential
from azure.common.credentials import ServicePrincipalCredentials
DefaultAzureCredential is the modern, recommended way to authenticate across various environments. Older credential types are largely deprecated in Track 2 SDKs.

This quickstart demonstrates how to authenticate, create an `AutomationClient`, and perform basic operations like listing and retrieving Azure Automation accounts. It relies on environment variables for configuration and `DefaultAzureCredential` for flexible authentication.

import os from azure.identity import DefaultAzureCredential from azure.mgmt.automation import AutomationClient # Ensure you have your Azure Subscription ID set as an environment variable # For example: export AZURE_SUBSCRIPTION_ID='your-subscription-id' subscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', '') resource_group_name = 'myResourceGroup' automation_account_name = 'myAutomationAccount' if not subscription_id: raise ValueError("AZURE_SUBSCRIPTION_ID environment variable not set.") # Authenticate using DefaultAzureCredential (supports various methods: AZURE_CLI, ENV VARS, Managed Identity, etc.) credential = DefaultAzureCredential() # Create an Automation client automation_client = AutomationClient(credential, subscription_id) try: # Example: List automation accounts in a resource group print(f"Listing automation accounts in resource group '{resource_group_name}':") automation_accounts = automation_client.automation_accounts.list_by_resource_group(resource_group_name) for account in automation_accounts: print(f" - {account.name} (Location: {account.location})") # Example: Get a specific automation account account = automation_client.automation_accounts.get(resource_group_name, automation_account_name) print(f"\nRetrieved automation account: {account.name}") except Exception as e: print(f"An error occurred: {e}") print("Please ensure the resource group and automation account exist and your credentials have permission.")
Debug
Known issues
breakingMigration from 'Track 1' (older) to 'Track 2' Azure SDKs involves significant breaking changes in package names, import paths, and client constructors. `azure-mgmt-automation` version 1.0.0 is a 'Track 2' SDK.
fix
Update import statements from `azure.mgmt.<service>` to `azure.mgmt.<service>.models` for model objects, and use `AutomationClient(credential, subscription_id)` for client instantiation. Refer to the Azure SDK migration guides for details.
affects: <1.0.0
gotchaAuthentication can be complex, especially managing credentials across development environments (local, dev, prod). `DefaultAzureCredential` attempts multiple authentication methods sequentially.
fix
For local development, ensure you are logged in via Azure CLI (`az login`) or set environment variables like `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. For deployed applications, use Managed Identity where possible.
affects: All
gotchaResource group and subscription ID are crucial context for almost all Azure management operations. Incorrect IDs or names will lead to 'Resource Not Found' errors.
fix
Always verify resource group names, subscription IDs, and resource names. Use `az group list` and `az account show` via Azure CLI to confirm details.
affects: All
deprecatedDirect usage of older credential types like `ServicePrincipalCredentials` or `TokenCredential` subclasses from `msrestazure.azure_active_directory` is deprecated in favor of `azure-identity`'s `DefaultAzureCredential` or specific credential types from `azure.identity`.
fix
Adopt `from azure.identity import DefaultAzureCredential` and configure your environment for it. This provides a unified and more secure authentication experience.
affects: <1.0.0 (for old SDKs), all (for recommended practice)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'azure.mgmt.automation'
The `azure-mgmt-automation` package is not installed in your Python environment.
fix
Run `pip install azure-mgmt-automation` to install the library.
CredentialUnavailableError: DefaultAzureCredential failed to retrieve a token.
The `DefaultAzureCredential` could not find any valid authentication credentials configured in your environment (e.g., Azure CLI login, environment variables, Managed Identity).
fix
For local development, run `az login` in your terminal or set `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, and `AZURE_CLIENT_SECRET` environment variables. Ensure the logged-in user or service principal has the necessary permissions.
azure.core.exceptions.ResourceNotFoundError: The resource group 'myNonExistentResourceGroup' could not be found.
The specified resource group name does not exist or is misspelled, or the authenticated identity lacks permissions to view it.
fix
Verify the resource group name for correctness. Use `az group list` to check existing resource groups. Ensure your Azure identity has 'Reader' or 'Contributor' permissions on the subscription or resource group.
azure.core.exceptions.ClientAuthenticationError: Access denied to subscription 'your-subscription-id'.
The authenticated identity does not have sufficient permissions to perform the requested operation on the specified subscription or resource.
fix
Check the role assignments for your Azure identity in the Azure portal or via Azure CLI (`az role assignment list`). Ensure it has roles like 'Automation Contributor' or 'Contributor' on the relevant scope (subscription, resource group, or specific resource).
Upgrade
Version history
1.0.1latest on PyPI · released May 14, 2026
Audit
Dependencies
azure-corerequiredProvides shared primitives, exceptions, and helpers for Azure SDK libraries.
azure-mgmt-corerequiredProvides core management plane functionalities for Azure management SDKs.
azure-identityoptionalRecommended for authentication, providing credential types like DefaultAzureCredential.
Agent activity
30 hits · last 30 days
node
26
OpenAI (training)
1
Resources