AzureCliAuthentication Class
Manages authentication and acquires an access token using the Azure CLI.
To use this class you must have the azure-cli package installed. For a better Azure Notebooks experience, use the InteractiveLoginAuthentication class.
Class Azure Cli Authentication constructor.
- Inheritance
-
AzureCliAuthentication
Constructor
AzureCliAuthentication(cloud=None)
Parameters
- cloud
- str
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.
- cloud
- str
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.
Remarks
If you have installed azure-cli package, and used az login command to log in to your Azure Subscription, then you can use the AzureCliAuthentication class.
from azureml.core.authentication import AzureCliAuthentication
cli_auth = AzureCliAuthentication()
ws = Workspace(subscription_id="my-subscription-id",
resource_group="my-ml-rg",
workspace_name="my-ml-workspace",
auth=cli_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
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for