Microsoft Azure Batch AI Management Client Library
The `azure-mgmt-batchai` Python client library provides functionality to manage Azure Batch AI resources. However, the Azure Batch AI service itself was retired on March 31, 2019. The `azure-mgmt-batchai` package is deprecated and received only security fixes until October 31, 2024. Users are strongly advised to migrate to the Azure Machine Learning service and its corresponding SDK, `azureml-core`, for at-scale training and machine learning capabilities. This library is not actively maintained for new features or non-security bug fixes.
Warnings
- breaking The underlying Azure Batch AI service has been retired as of March 31, 2019. New subscriptions cannot register for or create Batch AI resources. Existing deployments were subject to a grace period, but the service is no longer supported.
- deprecated The `azure-mgmt-batchai` package is deprecated and will no longer be maintained for new features or non-security bug fixes after October 31, 2024. Only security fixes were provided until that date.
- breaking Version 7.x introduced a complete revamp of the credential system. Old authentication methods (e.g., `azure.common.credentials`, `msrestazure.azure_active_directory`) are no longer supported.
- breaking Significant API specification changes in versions 2.0.0 and 7.x. For example, `Clusters` and `FileServers` must be created under a `Workspace`, `Jobs` under an `Experiment`. Resources no longer accept `location` or `tags` during creation. Method names like `BatchAIManagementClient.usage` were renamed to `BatchAIManagementClient.usages`.
- gotcha Long-Running Operations (LROs) in version 7.x now return `azure.core.polling.LROPoller` and are typically prefixed with `begin_` (e.g., `begin_create`). This replaces `msrest.polling.LROPoller` from earlier versions.
Install
-
pip install azure-mgmt-batchai -
pip install azure-identity
Imports
- BatchAIManagementClient
from azure.mgmt.batchai import BatchAIManagementClient
- DefaultAzureCredential
from azure.identity import DefaultAzureCredential
Quickstart
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.batchai import BatchAIManagementClient
# WARNING: The Azure Batch AI service has been retired as of March 31, 2019.
# This SDK package is deprecated and is no longer maintained for new features.
# New subscriptions cannot create Batch AI resources. This code is for illustration only.
# Users should migrate to Azure Machine Learning service (azureml-core).
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "") # Your Azure Subscription ID
if not subscription_id:
raise ValueError("AZURE_SUBSCRIPTION_ID environment variable not set.")
# Authenticate with Azure (using recommended DefaultAzureCredential)
credential = DefaultAzureCredential()
# Create a Batch AI Management client
client = BatchAIManagementClient(credential, subscription_id)
print("Azure Batch AI Management Client instantiated.")
print("Note: The Azure Batch AI service has been retired and this SDK is deprecated.")
print("Attempting operations will likely result in service-level errors.")
print("Consider migrating to the Azure Machine Learning service.")