MsiAuthentication Class

Manages authentication using a managed identity in Azure Active Directory.

When using Azure ML SDK on Azure Virtual Machine (VM), you can authenticate with a managed identity (formerly known as Managed Service Identity - MSI). Using a managed identity allows the VM connect to your workspace without storing credentials in Python code, thus decoupling the authentication process from any specific user login.

Class MsiAuthentication constructor.

Inheritance
MsiAuthentication

Constructor

MsiAuthentication(cloud=None, **kwargs)

Parameters

cloud
str
default value: None

The name of the target cloud. Can be one of "AzureCloud", "AzureChinaCloud", or "AzureUSGovernment". If no cloud is specified, any configured default from the Azure CLI is used. If no default is found, "AzureCloud" is used.

identity_config
Mapping[str, str]
Required

a mapping {parameter_name: value} specifying a user-assigned identity by its object or resource ID, for example {"client_id": "..."}. Check the documentation for your hosting environment to learn what values it expects.

cloud
str
Required

The name of the target cloud. Can be one of "AzureCloud", "AzureChinaCloud", or "AzureUSGovernment". If no cloud is specified, any configured default from the Azure CLI is used. If no default is found, "AzureCloud" is used.

identity_config
Mapping[str, str]
Required

a mapping {parameter_name: value} specifying a user-assigned identity by its object or resource ID, for example {"client_id": "..."}. Check the documentation for your hosting environment to learn what values it expects.

Remarks

The following example shows how to use MsiAuthentication.


   from azureml.core.authentication import MsiAuthentication

   msi_auth = MsiAuthentication()

   ws = Workspace(subscription_id="my-subscription-id",
                  resource_group="my-ml-rg",
                  workspace_name="my-ml-workspace",
                  auth=msi_auth)

   print("Found workspace {} at location {}".format(ws.name, ws.location))

Full sample is available from https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/manage-azureml-service/authentication-in-azureml/authentication-in-azureml.ipynb