question

MuqaddasAbbas-2550 avatar image
0 Votes"
MuqaddasAbbas-2550 asked romungi-MSFT commented

NameError: name 'load_workspace_from_config' is not defined

i simply want to get the datastore name from my azure workspace so I can use it in databricks. i found this code
import azureml.core
from azureml.core import Workspace, Datastore


ws = load_workspace_from_config(path="config.json")
ds = get_default_datastore(ws)
print(ds)

I am facing error on this that
NameError: name 'load_workspace_from_config' is not defined

azure-machine-learning
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@MuqaddasAbbas-2550 Did the below suggestion help to load your workspace correctly with the SDK?

0 Votes 0 ·

1 Answer

romungi-MSFT avatar image
0 Votes"
romungi-MSFT answered

@MuqaddasAbbas-2550 In this case you will have to use Workspace.from_config() This call will then prompt an interactive login to Azure portal.

Ex:

    ws = Workspace.from_config()
    ws.get_details()

Before calling this you will have to specify the config file path with details of your subscription and workspace.

    ws.write_config(path="./file-path", file_name="ws_config.json")

The JSON file should contain details of your subscription, resource group and workspace.

 {
     "subscription_id": "<subscription-id>",
     "resource_group": "<resource-group>",
     "workspace_name": "<workspace-name>"
 }

Please refer the documentation for more details.


If an answer is helpful, please click on 130616-image.png or upvote 130671-image.png which might help other community members reading this thread.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.