This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
We are excited to introduce the GA of Azure Machine Learning Python SDK v2. The Python SDK v2 introduces new SDK capabilities like standalone local jobs, reusable components for pipelines and managed online/batch inferencing. Python SDK v2 allows you to move from simple to complex tasks easily and incrementally. This is enabled by using a common object model which brings concept reuse and consistency of actions across various tasks. The SDK v2 shares its foundation with the CLI v2 which is also GA.
Source code|Package (PyPI)|Package (Conda)|API reference documentation|Product documentation|Samples
This package has been tested with Python 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13.
For a more complete set of Azure libraries, seehttps://aka.ms/azsdk/python/all
Install the Azure ML client library for Python withpip:
pip install azure-ai-mlpip install azure-identityfrom azure.ai.ml import MLClientfrom azure.identity import DefaultAzureCredentialml_client = MLClient( DefaultAzureCredential(), subscription_id, resource_group, workspace)Refer the below high level sequence diagram illustrating the package's workflow:

The sequence diagram above illustrates the architecture and workflow of the Azure ML Python SDK v2. Here's an explanation of the key components:
The diagram depicts two main workflows:
Entity Creation and Validation:
Operation Execution:
Azure Machine Learning Python SDK v2 comes with many new features like standalone local jobs, reusable components for pipelines and managed online/batch inferencing. The SDK v2 brings consistency and ease of use across all assets of the platform. The Python SDK v2 offers the following capabilities:
Azure ML clients raise exceptions defined inAzure Core.
from azure.core.exceptions import HttpResponseErrortry: ml_client.compute.get("cpu-cluster")except HttpResponseError as error: print("Request failed: {}".format(error.message))This library uses the standardlogging library for logging.Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFOlevel.
Detailed DEBUG level logging, including request/response bodies and unredactedheaders, can be enabled on a client with thelogging_enable argument.
See full SDK logging documentation with exampleshere.
The Azure ML Python SDK includes a telemetry feature that collects usage and failure data about the SDK and sends it to Microsoft when you use the SDK in a Jupyter Notebook only.Telemetry willnot be collected for any use of the Python SDK outside of a Jupyter Notebook.
Telemetry data helps the SDK team understand how the SDK is used so it can be improved and the information about failures helps the team resolve problems and fix bugs.The SDK telemetry feature is enabled by default for Jupyter Notebook usage and cannot be enabled for non-Jupyter scenarios. To opt out of the telemetry feature in a Jupyter scenario, pass inenable_telemetry=False when constructing your MLClient object.
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, visitcla.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., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted theMicrosoft Open Source Code of Conduct. For more information see theCode of Conduct FAQ or contactopencode@microsoft.com with any additional questions or comments.
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Want to try using Ask Learn to clarify or guide you through this topic?