<?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: How to identify session user of a notebook in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-identify-session-user-of-a-notebook/m-p/4317040#M5520</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/283494"&gt;@PriyaJha&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;getpass.getuser() is likely to return the internal user that the notebook is exeecuting as on the Spark node.&lt;BR /&gt;If you want to get the name of the logged in user (as controlled by Entra ID / Fabric), then you should use the following function to return the user running the job.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;mssparkutils&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;env&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getUserName&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;This returns the user who is executing the notebook.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Be aware we have seen some unusual behaviour in the Monitoring hub when user A is executing a pipeline + notebook activity owned by user B.&amp;nbsp; In this case we have seen the pipeline executing under user A, but the notebook executing as user B.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If there is any post&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;, then please consider&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 07 Dec 2024 16:24:32 GMT</pubDate>
    <dc:creator>spencer_sa</dc:creator>
    <dc:date>2024-12-07T16:24:32Z</dc:date>
    <item>
      <title>How to identify session user of a notebook</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-identify-session-user-of-a-notebook/m-p/4316969#M5518</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to identify what user name does a notebook takes when it is been executed by an individual and via data pipeline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am executing following code in a notebook--&lt;/P&gt;&lt;P&gt;getpass.getuser()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The ouuput is -- trusted-service-user&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When this notebook is called in a data pipeline, the output is same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please explain what is&amp;nbsp;trusted-service-user and how to idenify execution user or session user of a notebook when triggered by an individual and when called in a pipeline.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Dec 2024 11:58:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-identify-session-user-of-a-notebook/m-p/4316969#M5518</guid>
      <dc:creator>PriyaJha</dc:creator>
      <dc:date>2024-12-06T11:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify session user of a notebook</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-identify-session-user-of-a-notebook/m-p/4317040#M5520</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/283494"&gt;@PriyaJha&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;getpass.getuser() is likely to return the internal user that the notebook is exeecuting as on the Spark node.&lt;BR /&gt;If you want to get the name of the logged in user (as controlled by Entra ID / Fabric), then you should use the following function to return the user running the job.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;mssparkutils&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;env&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;getUserName&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;This returns the user who is executing the notebook.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Be aware we have seen some unusual behaviour in the Monitoring hub when user A is executing a pipeline + notebook activity owned by user B.&amp;nbsp; In this case we have seen the pipeline executing under user A, but the notebook executing as user B.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If there is any post&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;, then please consider&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2024 16:24:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-identify-session-user-of-a-notebook/m-p/4317040#M5520</guid>
      <dc:creator>spencer_sa</dc:creator>
      <dc:date>2024-12-07T16:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify session user of a notebook</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-identify-session-user-of-a-notebook/m-p/4318766#M5530</link>
      <description>&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/283494"&gt;@PriyaJha&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;If these also don't help, please share more detailed information and description to help us clarify your scenario to test.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 01:12:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-identify-session-user-of-a-notebook/m-p/4318766#M5530</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-09T01:12:40Z</dc:date>
    </item>
  </channel>
</rss>

