Registry / azure / azure-mgmt-devtestlabs

azure-mgmt-devtestlabs

JSON →
library9.0.1pypypi✓ verified 23d ago

Microsoft Azure DevTestLabs Management Client Library for Python, currently at version 9.0.0. This library provides programmatic access to manage Azure DevTest Labs resources, including labs, virtual machines, custom images, and schedules. Azure SDK libraries typically follow a regular release schedule, with updates for new features and bug fixes.

pip install azure-mgmt-devtestlabs
INSTALL
IMPORT
SIG · AZURE-MGMT-DEVTEST
A
azure-mgmt-devtestlabs
azurepythonv9.0.1
Install
2.7s avg
Import
596ms
Disk
25MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v9.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.95 runs
installs and imports cleanly · install 0.0s · import 0.626s · 26.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.7s · import 0.566s · 27MB
25MB installed
● package 25MB
Code
Verified usage

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

DevTestLabsClient
from azure.mgmt.devtestlabs import DevTestLabsClient
from azure.mgmt.devtestlabs import DevTestLabsManagementClient
In V2 of the Azure SDK for Python, the main management client class name was simplified from `DevTestLabsManagementClient` to `DevTestLabsClient`.
DefaultAzureCredential
from azure.identity import DefaultAzureCredential
This is the recommended credential type for most applications, attempting to authenticate via various common methods.

This quickstart demonstrates how to instantiate the DevTestLabsClient using DefaultAzureCredential and then list all DevTest Labs available within your Azure subscription. Ensure `AZURE_SUBSCRIPTION_ID` is set in your environment variables for this to run.

import os from azure.identity import DefaultAzureCredential from azure.mgmt.devtestlabs import DevTestLabsClient # Set your Azure Subscription ID as an environment variable # E.g., export AZURE_SUBSCRIPTION_ID="<your-subscription-id>" subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "") if not subscription_id: raise ValueError("AZURE_SUBSCRIPTION_ID environment variable not set.") # Authenticate using DefaultAzureCredential # This will try various authentication methods, like environment variables, # managed identity, Azure CLI, VS Code, etc. credential = DefaultAzureCredential() # Create a DevTestLabsClient client = DevTestLabsClient(credential, subscription_id) # Example: List all DevTest Labs in the subscription print("Listing DevTest Labs:") for lab in client.labs.list_by_subscription(): print(f" Lab Name: {lab.name}, Location: {lab.location}")
Debug
Known issues
breakingThe primary client class name changed from `DevTestLabsManagementClient` to `DevTestLabsClient` in the V2 SDK. Code written for older versions will need to update the import and instantiation.
fix
Update your import statement to `from azure.mgmt.devtestlabs import DevTestLabsClient` and instantiate the client as `DevTestLabsClient(credential, subscription_id)`.
affects: Prior to 9.0.0 (V2 SDK)
breakingResource models and API methods may have changed significantly between major versions (e.g., V1 to V2 SDK). Property names, argument order, and response structures might differ, leading to `AttributeError` or `TypeError`.
fix
Consult the official V2 SDK documentation and API reference for the `azure-mgmt-devtestlabs` library to understand the updated resource models and method signatures. Update your code to reflect the new structure.
affects: Prior to 9.0.0 (V2 SDK)
gotchaThe library provides both synchronous (`DevTestLabsClient`) and asynchronous (`DevTestLabsClientAsync`) clients. Ensure you are using the correct client type for your application's concurrency model (e.g., `async/await` for asynchronous operations).
fix
For synchronous code, use `DevTestLabsClient`. For asynchronous code, import and use `DevTestLabsClientAsync` and ensure your calls are awaited within an `async` function.
affects: All V2 versions (9.x.x+)
gotchaMany list operations (e.g., `client.labs.list_by_subscription()`) return an iterable object that performs pagination under the hood. Not all items might be immediately available, and the iterator must be fully consumed to retrieve all results.
fix
Always iterate over the returned collection directly (e.g., `for lab in client.labs.list_by_subscription():`) rather than assuming it's a simple list or accessing elements by index directly, to ensure all pages are fetched.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'azure.mgmt.devtestlabs'
The `azure-mgmt-devtestlabs` package, or its dependencies, are not installed in the current Python environment.
fix
Ensure the library is installed using pip: `pip install azure-mgmt-devtestlabs` and `pip install azure-identity` for authentication.
AttributeError: 'DevTestLabsClient' object has no attribute 'config'
In `azure-mgmt-devtestlabs` version 9.0.0 and newer, the `config` attribute was removed due to breaking changes in the Azure SDK's next-generation code generator, which revamped client configuration.
fix
Instead of accessing `client.config.attribute`, pass configuration parameters directly as keyword arguments to the client's constructor or relevant methods. For example, `DevTestLabsClient(credential, subscription_id, enable_logging=True)`.
from azure.mgmt.devtestlabs.dev_test_labs_management_client import DevTestLabsClient
This import path is deprecated in `azure-mgmt-devtestlabs` version 4.0.0 and later, including 9.0.0. The `DevTestLabsClient` class is now directly available from the top-level package.
fix
Use the simplified import statement: `from azure.mgmt.devtestlabs import DevTestLabsClient`.
azure.core.exceptions.ClientAuthenticationError: DefaultAzureCredential failed to retrieve a token from the included credentials.
The `DefaultAzureCredential` could not find valid credentials in the expected locations (environment variables, managed identity, Azure CLI, etc.) to authenticate with Azure.
fix
Ensure that one of the supported authentication methods for `azure-identity` is configured. This often involves setting environment variables (`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`) for a Service Principal, or logging in via Azure CLI (`az login`).
(ResourceNotFound) The Resource 'Microsoft.DevTestLab/labs/your-lab-name' under resource group 'your-resource-group' was not found.
The specified Azure DevTest Lab resource, or its containing resource group, does not exist, or the authenticated identity does not have permission to access it, or there is a typo in the resource name or resource group name.
fix
Verify that the resource name, resource group name, and subscription ID are correct and that the principal used for authentication has the necessary permissions (e.g., Reader role or specific DevTest Labs roles) on the resource or subscription.
Upgrade
Version history
9.0.1latest on PyPI · released May 18, 2026
Audit
Dependencies
azure-identityrequiredRequired for authentication using Azure Active Directory credentials, such as DefaultAzureCredential.
azure-corerequiredProvides core functionalities for Azure SDK clients, including shared exceptions and HTTP pipeline.
Agent activity
48 hits · last 30 days
node
40
Amazon
1
OpenAI (training)
1
Resources
azure-mgmt-devtestlabs — pip install azure-mgmt-devtestlabs · libregistry