MLClient Class

A client class to interact with Azure ML services.

Use this client to manage Azure ML resources, e.g. workspaces, jobs, models and so on.

Inheritance
builtins.object
MLClient

Constructor

MLClient(credential: azure.core.credentials.TokenCredential, subscription_id: str, resource_group_name: str, workspace_name: Optional[str] = None, registry_name: Optional[str] = None, **kwargs: Any)

Parameters

credential
subscription_id
resource_group_name
workspace_name
default value: None
registry_name
default value: None

Methods

begin_create_or_update

Creates or updates an Azure ML resource asynchronously.

create_or_update

Creates or updates an Azure ML resource.

from_config

Return a workspace object from an existing Azure Machine Learning Workspace.

Reads workspace configuration from a file. Throws an exception if the config file can't be found.

The method provides a simple way to reuse the same workspace across multiple Python notebooks or projects. Users can save the workspace Azure Resource Manager (ARM) properties using the workspace.write_config method, and use this method to load the same workspace in different Python notebooks or projects without retyping the workspace ARM properties.

begin_create_or_update

Creates or updates an Azure ML resource asynchronously.

begin_create_or_update(entity: R, **kwargs) -> azure.core.polling._poller.LROPoller[R]

Parameters

entity
<xref:Union>[<xref:azure.ai.ml.entities.Workspace,azure.ai.ml.entities.Compute,azure.ai.ml.entities.OnlineDeployment,azure.ai.ml.entities.OnlineEndpoint,azure.ai.ml.entities.BatchDeployment,azure.ai.ml.entities.BatchEndpoint,azure.ai.ml.entities.JobSchedule>]
Required

The resource to create or update.

Returns

The resource after create/update operation

Return type

LROPoller[<xref:Union>[<xref:azure.ai.ml.entities.Workspace,azure.ai.ml.entities.Compute,azure.ai.ml.entities.OnlineDeployment,azure.ai.ml.entities.OnlineEndpoint,azure.ai.ml.entities.BatchDeployment,azure.ai.ml.entities.BatchEndpoint,azure.ai.ml.entities.JobSchedule>]]

create_or_update

Creates or updates an Azure ML resource.

create_or_update(entity: T, **kwargs) -> T

Parameters

entity
<xref:Union>[<xref:azure.ai.ml.entities.Job,azure.ai.ml.entities.Model,azure.ai.ml.entities.Environment,azure.ai.ml.entities.Component,azure.ai.ml.entities.Datastore,azure.ai.ml.entities.WorkspaceModelReference>]
Required

The resource to create or update.

Returns

The created or updated resource

Return type

<xref:Union>[<xref:azure.ai.ml.entities.Job,azure.ai.ml.entities.Model,azure.ai.ml.entities.Environment,azure.ai.ml.entities.Component,azure.ai.ml.entities.Datastore>]

from_config

Return a workspace object from an existing Azure Machine Learning Workspace.

Reads workspace configuration from a file. Throws an exception if the config file can't be found.

The method provides a simple way to reuse the same workspace across multiple Python notebooks or projects. Users can save the workspace Azure Resource Manager (ARM) properties using the workspace.write_config method, and use this method to load the same workspace in different Python notebooks or projects without retyping the workspace ARM properties.

from_config(credential: azure.core.credentials.TokenCredential, *, path: Optional[Union[os.PathLike, str]] = None, file_name=None, **kwargs) -> azure.ai.ml._ml_client.MLClient

Parameters

credential
<xref:azureml.core.credentials.TokenCredential>
Required

The credential object for the workspace.

path
str
Required

The path to the config file or starting directory to search. The parameter defaults to starting the search in the current directory.

file_name
str
Required

Allows overriding the config file name to search for when path is a directory path.

kwargs
dict
Required

A dictionary of additional configuration parameters. For e.g. kwargs = {"cloud": "AzureUSGovernment"}

Returns

The workspace object for an existing Azure ML Workspace.

Return type

Attributes

R

T

batch_deployments

A collection of batch deployment related operations.

Returns

Batch Deployment operations

Return type

batch_endpoints

A collection of batch endpoint related operations.

Returns

Batch Endpoint operations

Return type

components

A collection of component related operations.

Returns

Component operations

Return type

compute

A collection of compute related operations.

Returns

Compute operations

Return type

connections

A collection of workspace connection related operations.

Returns

Workspace Connections operations

Return type

data

A collection of data related operations.

Returns

Data operations

Return type

datastores

A collection of datastore related operations.

Returns

Datastore operations

Return type

environments

A collection of environment related operations.

Returns

Environment operations

Return type

jobs

A collection of job related operations.

Returns

Job operations

Return type

<xref:JObOperations>

models

A collection of model related operations.

Returns

Model operations

Return type

online_deployments

A collection of online deployment related operations.

Returns

Online Deployment operations

Return type

online_endpoints

A collection of online endpoint related operations.

Returns

Online Endpoint operations

Return type

resource_group_name

Get the resource group name of a MLClient object.

Returns

An Azure resource group name.

Return type

str

schedules

A collection of schedule related operations

Returns

Schedule operations

Return type

<xref:ScheduleOperations>

subscription_id

Get the subscription Id of a MLClient object.

Returns

An Azure subscription Id.

Return type

str

workspace_name

The workspace where workspace dependent operations will be executed in.

Returns

Default workspace name

Return type

<xref:Optional>[str]

workspaces

A collection of workspace related operations.

Returns

Workspace operations

Return type