Hi Oscar Suarez,
Thank you for reaching out to us on the Microsoft Q&A forum.
To obtain the workspace_id from the workspace_name in Microsoft Fabric, you can use the sempy library. Here’s a step-by-step guide:
%pip install -U semantic-link
import sempy.fabric as fabric
# Get the list of all workspacesworkspaces = fabric.list_workspaces()
# Filter the workspace by name and get the IDworkspace_name = "your_workspace_name"workspace_row = workspaces[workspaces['Name'] == workspace_name]
workspace_id = workspace_row['Id'].values[0]
print(f"The workspace ID for {workspace_name} is {workspace_id}")
This code will list all workspaces, filter by the given workspace_name, and then retrieve the corresponding workspace_id.
I have created a repro for the same scenario. Please refer to the below screenshot:
You can refer to this link for more help: https://community.fabric.microsoft.com/t5/General-Discussion/Is-there-a-function-to-check-the-workspace-name-ID-in-Fabric/m-p/3800046
Please don't hesitate to reach out to us if you have any other queries.
If the information is helpful, please Accept Answer & Upvote so that it would be helpful to other community members.