Knowledge Graph — Coursera Notes › Academic disciplines › Information Technology / Computer Science › Artificial Intelligence › Machine Learning & Data › Azure Machine Learning Service
Azure ML authentication methods
feature · part of Azure Machine Learning Service
Azure Machine Learning supports multiple authentication methods to secure access to workspaces and resources. The five primary methods are:
- Interactive login authentication — default for development, uses
Workspace.from_config(). - Azure CLI authentication — for CLI users, uses
AzureCliAuthentication. - Managed service identity (MSI) authentication — for Azure-hosted services, uses
ManagedIdentityCredential. - Service principal authentication — for automated workflows/CI/CD, uses
ServicePrincipalAuthentication. - Token authentication — for external integrations, uses
InteractiveLoginAuthenticationwith a token.
Each method has specific use cases and setup steps.
For troubleshooting, specify Subscription ID, Resource group, and Workspace name from Azure portal.
- Azure CLI authentication — preferred for users comfortable with CLI tools. Steps: 1. Install Azure CLI. 2. Log in via
az login. 3. In script:from azureml.core.authentication import AzureCliAuthenticationthencli_auth = AzureCliAuthentication()andws = Workspace.from_config(auth=cli_auth).
az login
from azureml.core.authentication import AzureCliAuthentication
cli_auth = AzureCliAuthentication()
ws = Workspace.from_config(auth=cli_auth)
- Managed identity authentication — eliminates passwords/secrets, highly secure for Azure-hosted services. Steps: 1. Ensure environment supports MSI (Azure VMs/services). 2. Use
ManagedIdentityCredentialfromazure.identity. 3. Create workspace:ws = Workspace(subscription_id=..., resource_group=..., workspace_name=..., credential=credential).
from azure.identity import ManagedIdentityCredential
from azureml.core import Workspace
credential = ManagedIdentityCredential()
ws = Workspace(subscription_id="your_subscription_id", resource_group="your_resource_group", workspace_name="your_workspace_name", credential=credential)
- Service principal authentication — ideal for automated workflows/CI/CD with strict access control. Steps: 1. Register an app in Azure AD, record Application ID, Tenant ID, Client Secret. 2. Grant Service Principal access to Azure ML workspace. 3. In script:
from azureml.core.authentication import ServicePrincipalAuthenticationthensvc_pr = ServicePrincipalAuthentication(tenant_id=..., service_principal_id=..., service_principal_password=...)andws = Workspace.from_config(auth=svc_pr).
from azureml.core.authentication import ServicePrincipalAuthentication
svc_pr = ServicePrincipalAuthentication(tenant_id="your_tenant_id", service_principal_id="your_application_id", service_principal_password="your_client_secret")
ws = Workspace.from_config(auth=svc_pr)
- Token authentication — offers granular control for external integrations. Steps: 1. Generate a token externally using Azure-compatible tools. 2. In script:
from azureml.core.authentication import InteractiveLoginAuthenticationthentoken_auth = InteractiveLoginAuthentication(token="your_token_here")andws = Workspace.from_config(auth=token_auth).
from azureml.core.authentication import InteractiveLoginAuthentication
token_auth = InteractiveLoginAuthentication(token="your_token_here")
ws = Workspace.from_config(auth=token_auth)
- Key Vault authentication — securely manage secrets (API keys, passwords) in remote runs. Steps: 1. Link Azure ML workspace to a Key Vault. 2. Add secrets as key-value pairs. 3. Access in script:
ws = Workspace.from_config()thensecret = ws.get_default_keyvault().get_secret(name="your_secret_name").
from azureml.core import Workspace
ws = Workspace.from_config()
secret = ws.get_default_keyvault().get_secret(name="your_secret_name")
Also known as: Azure ML authentication methods, ML authentication methods
This is the text view of an interactive 3D knowledge graph — open this page with JavaScript enabled to explore it visually.