<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Need to grab the Workspace Name from the System Variables in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/4053347#M4652</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created an idea of this:&lt;BR /&gt;&lt;A href="https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=2b777168-fc47-ef11-b4ad-000d3a0f9a18" target="_blank"&gt;https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=2b777168-fc47-ef11-b4ad-000d3a0f9a18&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Please, go to vote for it, so it will get implemented faster.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2024 07:33:32 GMT</pubDate>
    <dc:creator>TimoRiikonen</dc:creator>
    <dc:date>2024-07-22T07:33:32Z</dc:date>
    <item>
      <title>Need to grab the Workspace Name from the System Variables</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/3571310#M1328</link>
      <description>&lt;P&gt;In ADF and Synapse you can get the Workspace name from the System Variables in the Expression Builder as seen below.&amp;nbsp; But in Fabric Data Factory pipelines you only get the workspace ID which is a GUID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Synapse Pipelines:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ADF Pipelines:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Microsoft Fabric:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2024 14:36:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/3571310#M1328</guid>
      <dc:creator>12angrymentiger</dc:creator>
      <dc:date>2024-03-28T14:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need to grab the Workspace Name from the System Variables</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/3571916#M1336</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="641067" data-lia-user-login="12angrymentiger" class="lia-mention lia-mention-user"&gt;12angrymentiger&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;SPAN&gt;Thanks for using Fabric Community.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Currently this option is not available but we are open for feedback to improve our product.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Appreciate if you could share the feedback on our&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://ideas.fabric.microsoft.com/" target="_blank" rel="nofollow noopener noreferrer"&gt;feedback channel&lt;/A&gt;&lt;SPAN&gt;. Which would be open for the user community to upvote &amp;amp; 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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps. Please let me know if you have any further queries.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 09:37:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/3571916#M1336</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-04T09:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: Need to grab the Workspace Name from the System Variables</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/3795609#M2295</link>
      <description>&lt;P&gt;Really need this now that data pipelines are git-supported.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2024 18:45:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/3795609#M2295</guid>
      <dc:creator>dowsk</dc:creator>
      <dc:date>2024-03-28T18:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need to grab the Workspace Name from the System Variables</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/3970801#M3744</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 09:36:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/3970801#M3744</guid>
      <dc:creator>ajomat</dc:creator>
      <dc:date>2024-06-04T09:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need to grab the Workspace Name from the System Variables</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/4027420#M4432</link>
      <description>&lt;P&gt;You can use a notebook &lt;EM&gt;NB_GetWorkspaceNameById&lt;/EM&gt; to convert ID into name. In a notebook you can use the Fabric API to get info on a workspace by ID.&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/rest/api/fabric/core/workspaces/get-workspace?tabs=HTTP" target="_blank" rel="noopener"&gt;Workspaces - Get Workspace - REST API (Core) | Microsoft Learn&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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 &lt;EM&gt;NB_GetAccessToken&lt;/EM&gt; before running the pipeline.&lt;BR /&gt;&lt;BR /&gt;Maybe you could even do it without notebook and in the pipeline with a web activity:&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/General-Discussion/Fabric-API-Service-Principle-alternatives/m-p/3704279" target="_blank" rel="noopener"&gt;Re: Fabric API - Service Principle alternatives - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;NB_GetWorkspaceNameById&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# 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']&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;NB_GetAccessToken&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# 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'])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 16:29:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/4027420#M4432</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-05T16:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need to grab the Workspace Name from the System Variables</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/4053347#M4652</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created an idea of this:&lt;BR /&gt;&lt;A href="https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=2b777168-fc47-ef11-b4ad-000d3a0f9a18" target="_blank"&gt;https://ideas.fabric.microsoft.com/ideas/idea/?ideaid=2b777168-fc47-ef11-b4ad-000d3a0f9a18&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Please, go to vote for it, so it will get implemented faster.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 07:33:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/Need-to-grab-the-Workspace-Name-from-the-System-Variables/m-p/4053347#M4652</guid>
      <dc:creator>TimoRiikonen</dc:creator>
      <dc:date>2024-07-22T07:33:32Z</dc:date>
    </item>
  </channel>
</rss>

