Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
In ADF and Synapse you can get the Workspace name from the System Variables in the Expression Builder as seen below. But in Fabric Data Factory pipelines you only get the workspace ID which is a GUID.
I really need to be able to grab the workspace name as that is used to dynamically set a variable as the workspace name contains the env in the name (DEV/UAT/PRD). The workspace name is also helpful for us to dynamically pull from those different storage accounts and an email is sent when the pipeline fails detailing which workspace was run etc...
Synapse Pipelines:
ADF Pipelines:
Microsoft Fabric:
Solved! Go to Solution.
Hi @12angrymentiger ,
Thanks for using Fabric Community.
Currently this option is not available but we are open for feedback to improve our product.
Appreciate if you could share the feedback on our feedback channel. Which would be open for the user community to upvote & comment on. This allows our product teams to effectively prioritize your request against our existing feature backlog and gives insight into the potential impact of implementing the suggested feature.
Hope this helps. Please let me know if you have any further queries.
You can use a notebook NB_GetWorkspaceNameById to convert ID into name. In a notebook you can use the Fabric API to get info on a workspace by ID.
Workspaces - Get Workspace - REST API (Core) | Microsoft Learn
However you need an access token with user interaction to use Fabric API. I currently have pipelines that need you to get an access token in NB_GetAccessToken before running the pipeline.
Maybe you could even do it without notebook and in the pipeline with a web activity:
Re: Fabric API - Service Principle alternatives - Microsoft Fabric Community
NB_GetWorkspaceNameById
# parameter cell start #
workspace_id = ''
access_token = ''
# parameter cell end #
import requests
url = f'https://api.fabric.microsoft.com/v1/workspaces/{workspace_id}'
headers = {
'Authorization': f'Bearer {access_token}'
}
response = requests.get(url, headers=headers)
response_json = response.json()
print(response.status_code)
print(response_json)
workspace_name = response_json['displayName']
NB_GetAccessToken
# parameter cell start #
tenant_id = ''
client_id = ''
# parameter cell end #
import requests
import json
from msal import PublicClientApplication
from datetime import datetime, timedelta
import pytz
app = PublicClientApplication(
client_id = client_id,
authority = 'https://login.microsoftonline.com/' + tenant_id
)
print("json response:")
scopes = ['https://api.fabric.microsoft.com/Workspace.ReadWrite.All https://api.fabric.microsoft.com/Item.ReadWrite.All']
json_response = app.initiate_device_flow(scopes = scopes)
print(json_response)
# Return the token as soon as user completes her/his part of device code flow
response_dict = app.acquire_token_by_device_flow(json_response)
try:
access_token = response_dict['access_token']
print("\naccess token:")
print(access_token)
expiration_time = datetime.now(pytz.timezone('Europe/Amsterdam')) + timedelta(seconds=response_dict['expires_in'])
print(f"\nexpiration time: {expiration_time}")
except:
print('\nSomething went wrong')
print(response_dict['error_description'])
Really need this now that data pipelines are git-supported.
Being able to reference a resource (ex. lakehouse inside of a notebook) that belongs to the same workspace that the data pipeline is associated with is essential for limiting execution scope. Before pipelines became supported, you could hard code the workspace name as a pipeline parameter since the pipelines weren't associated with each other.
Hi @12angrymentiger ,
Thanks for using Fabric Community.
Currently this option is not available but we are open for feedback to improve our product.
Appreciate if you could share the feedback on our feedback channel. Which would be open for the user community to upvote & comment on. This allows our product teams to effectively prioritize your request against our existing feature backlog and gives insight into the potential impact of implementing the suggested feature.
Hope this helps. Please let me know if you have any further queries.
Hello,
I have created an idea of this:
https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=2b777168-fc47-ef11-b4ad-000d3a0f9a18
Please, go to vote for it, so it will get implemented faster.
Hi,
The feedback channel link is not working. I also need to get the workspace name dynamically in one of the data pipelines so that I could use this workspace name to send notifications to the correct teams channel.
User | Count |
---|---|
6 | |
6 | |
4 | |
3 | |
3 |
User | Count |
---|---|
14 | |
10 | |
7 | |
7 | |
6 |