@sumit gupta Config file path which you have specified is not available. You need to specify the path correctly to write to the config file.
Please use the below code and update if that solves your issue.
ws.write_config(path="./file-path", file_name="ws_config.json")
To load the workspace from the configuration file, use the from_config method.
ws = Workspace.from_config()
ws.get_details()
If you ran the Azure Machine Learning quickstart in Azure Notebooks, you already have a configured workspace! You can go to your Azure Machine Learning Getting Started library, view config.json file, and copy-paste the values for subscription ID, resource group and workspace name below.
Replace the default values in the cell below with your workspace parameters
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 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")
Reference: Setting up your Azure Machine Learning services workspace and configuring your notebook library
If an answer is helpful, please click on or upvote which might help other community members reading this thread.