WorkspaceConnection Class

Azure ML 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.OpenAIConnection) instead of instantiating this class directly.

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

Constructor

WorkspaceConnection(*, type: str, credentials: PatTokenConfiguration | SasTokenConfiguration | UsernamePasswordConfiguration | ManagedIdentityConfiguration | ServicePrincipalConfiguration | AccessKeyConfiguration | ApiKeyConfiguration | NoneCredentialConfiguration | AccountKeyConfiguration | AadCredentialConfiguration, is_shared: bool = True, metadata: Dict[str, Any] | None = None, **kwargs: Any)

Parameters

Name Description
name
Required
str

Name of the connection.

target
Required
str

The URL or ARM resource ID of the external resource.

metadata
Required

Metadata dictionary.

type
Required
<xref:The type> of <xref: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, <xref:azure.ai.ml.entities.NoneCredentialConfiguration ~azure.ai.ml.entities.AccountKeyConfiguration>, AadCredentialConfiguration, None ]

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 project, this controls whether or not this connection is shared amongst other projects that are shared by the parent hub. Defaults to true.

Keyword-Only Parameters

Name Description
type
Required
credentials
Required
is_shared
Default value: True
metadata
Required

Methods

dump

Dump the connection spec into a file in yaml format.

dump

Dump the 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 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

api_base

Alternate name for the target of the connection, which is used by some connection subclasses.

Returns

Type Description
str

The target of the connection.

azure_endpoint

Alternate name for the target of the connection, which is used by some connection subclasses.

Returns

Type Description
str

The target of the connection.

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

endpoint

Alternate name for the target of the connection, which is used by some connection subclasses.

Returns

Type Description
str

The target of the 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 hub. Only applicable for connections created within a project.

Returns

Type Description

metadata

The connection's metadata dictionary. :return: This connection's metadata. :rtype: Optional[Dict[str, Any]]

tags

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

target

Target url for the connection.

Returns

Type Description

Target of the connection.

type

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

Returns

Type Description
str

Type of the job.

url

Alternate name for the target of the connection, which is used by some connection subclasses.

Returns

Type Description
str

The target of the connection.