Isn't Interactive login, default for Workspace.from_config()?

kalyan reddy 186 Reputation points
2020-11-23T02:13:34.39+00:00

According to this notebook

Interactive Authentication
Interactive authentication is the default mode when using Azure ML SDK.

When you connect to your workspace using workspace.from_config, you will get an interactive login dialog.

So, i ran ws=Workspace.from_config()
and got the following error

--------------------------------------------------------------------------
UserErrorException                        Traceback (most recent call last)
<ipython-input-13-e469111f639c> in <module>
----> 1 ws = Workspace.from_config()

~\Documents\Softwares\Anaconda3\lib\site-packages\azureml\core\workspace.py in from_config(path, auth, _logger, _file_name)
    276
    277             if not found_path:
--> 278                 raise UserErrorException(
    279                     'We could not find config.json in: {} or in its parent directories. '
    280                     'Please provide the full path to the config file or ensure that '

UserErrorException: UserErrorException:
        Message: We could not find config.json in: C:\Users\qwewqd or in its parent directories. Please provide the full path to the config file or ensure that config.json exists in the parent directories.
        InnerException None
        ErrorResponse
{
    "error": {
        "code": "UserError",
        "message": "We could not find config.json in: C:\\Users\\qwewqd or in its parent directories. Please provide the full path to the config file or ensure that config.json exists in the parent directories."
    }
}
Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,335 questions
0 comments No comments
{count} votes

Accepted answer
  1. romungi-MSFT 48,906 Reputation points Microsoft Employee Moderator
    2020-11-23T07:26:12.007+00:00

    @kalyan reddy A configuration file(JSON) is created when you run the configuration.ipynb file or notebook which can then be used to get the configuration using
    ws = Workspace.from_config()

    You can run this notebook and create a new workspace if not available or use the existing workspace. For example, Set the workspace details as environment varibles.

    import os  
      
    subscription_id = os.getenv("SUBSCRIPTION_ID", default="<my-subscription-id>")  
    resource_group = os.getenv("RESOURCE_GROUP", default="<my-resource-group>")  
    workspace_name = os.getenv("WORKSPACE_NAME", default="<my-workspace-name>")  
    workspace_region = os.getenv("WORKSPACE_REGION", default="eastus2")  
    

    Write then to config.json file

    from azureml.core import Workspace  
      
    try:  
        ws = Workspace(subscription_id = subscription_id, resource_group = resource_group, workspace_name = workspace_name)  
        # write the details of the workspace to a configuration file to the notebook library  
        ws.write_config()  
        print("Workspace configuration succeeded. Skip the workspace creation steps below")  
    except:  
        print("Workspace not accessible. Change your parameters or create a new workspace below")  
    

    You can now access this config from other notebooks and need not specify the subscription or workspace details in every notebook file.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.