WorkspaceConnection Class

Note

This is an experimental class, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.

Azure ML workspace connection provides a secure way to store authentication and configuration information needed to connect and interact with the external resources.

Note: For connections to OpenAI, Cognitive Search, and Cognitive Services, use the respective subclasses (ex: ~azure.ai.ml.entities.OpenAIWorkspaceConnection) instead of instantiating this class directly.

Inheritance
azure.ai.ml.entities._resource.Resource
WorkspaceConnection

Constructor

WorkspaceConnection(*, target: str, type: str, credentials: PatTokenConfiguration | SasTokenConfiguration | UsernamePasswordConfiguration | ManagedIdentityConfiguration | ServicePrincipalConfiguration | AccessKeyConfiguration | ApiKeyConfiguration, is_shared: bool = True, **kwargs: Any)

Parameters

Name Description
name
Required
str

Name of the workspace connection.

target
Required
str

The URL or ARM resource ID of the external resource.

tags
Required

Tag dictionary. Tags can be added, removed, and updated.

type
Required
<xref:<xref:The type> of <xref:workspace connection>, <xref:possible values are: "git">, <xref:"python_feed">, <xref:"container_registry">, <xref:"feature_store">, <xref:"s3">, <xref:"snowflake">, <xref:"azure_sql_db">, <xref:"azure_synapse_analytics">, <xref:"azure_my_sql_db">, <xref:"azure_postgres_db">, <xref:"adls_gen_2">, <xref:"azure_one_lake">, >

The category of external resource for this connection.

credentials
Required
Union[ PatTokenConfiguration, SasTokenConfiguration, UsernamePasswordConfiguration, <xref:azure.ai.ml.entities.ManagedIdentityConfiguration ~azure.ai.ml.entities.ServicePrincipalConfiguration>, AccessKeyConfiguration, ApiKeyConfiguration ]

The credentials for authenticating to the external resource. Note that certain connection types (as defined by the type input) only accept certain types of credentials.

is_shared
Required

For connections in lean workspaces, this controls whether or not this connection is shared amongst other lean workspaces that are shared by the parent hub. Defaults to true.

Methods

dump

Dump the workspace connection spec into a file in yaml format.

dump

Dump the workspace connection spec into a file in yaml format.

dump(dest: str | PathLike | IO, **kwargs: Any) -> None

Parameters

Name Description
dest
Required
Union[<xref:PathLike>, str, IO[AnyStr]]

The destination to receive this workspace connection's spec. Must be either a path to a local file, or an already-open file stream. If dest is a file path, a new file will be created, and an exception is raised if the file exists. If dest is an open file, the file will be written to directly, and an exception will be raised if the file is not writable.

Attributes

base_path

The base path of the resource.

Returns

Type Description
str

The base path of the resource.

creation_context

The creation context of the resource.

Returns

Type Description

The creation metadata for the resource.

credentials

Credentials for workspace connection.

]

Returns

Type Description

Credentials for workspace connection.

id

The resource ID.

Returns

Type Description

The global ID of the resource, an Azure Resource Manager (ARM) ID.

is_shared

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections created within a lean workspace.

Returns

Type Description

metadata

Deprecated. Use tags. :return: This connection's tags. :rtype: Dict[str, Any]

target

Target url for the workspace connection.

Returns

Type Description
str

Target of the workspace connection.

type

Type of the workspace connection, supported are 'git', 'python_feed' and 'container_registry'.

Returns

Type Description
str

Type of the job.