<?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 ArcPy SignInToPortal Doesn't Handle SAML Logins But ArcGIS Pro SDK ArcGISPortal Class Does in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-signintoportal-doesn-t-handle-saml-logins/m-p/1564949#M90851</link>
    <description>&lt;P&gt;This question is primarily for Esri staff.&amp;nbsp; I am interested in understanding why the ArcPy ArcGIS Online/Portal functions are so limited compared to the ArcGISPortal and ArcGISPortalManager classes in the ArcGIS Pro SDK.&amp;nbsp; I assume both ArcPy and ArcGIS Pro SDK are hooking into the same underlying compiled code, so I know more can be done with ArcPy since I can do it with Pro SDK in Python using &lt;A href="https://github.com/pythonnet/pythonnet" target="_self"&gt;GitHub - pythonnet/pythonnet: Python for .NET&lt;/A&gt; .&lt;/P&gt;&lt;P&gt;One specific issue is how &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/signintoportal.htm" target="_blank" rel="noopener"&gt;SignInToPortal—ArcGIS Pro | Documentation&lt;/A&gt; either doesn't work or doesn't work correctly with SAML logins.&amp;nbsp; It is not uncommon in my organization to have users with lots of Portals registered in ArcGIS Pro, many of which are SAML-based logins.&amp;nbsp; When using Pro SDK with &lt;A href="https://github.com/pythonnet/pythonnet" target="_self"&gt;GitHub - pythonnet/pythonnet: Python for .NET&lt;/A&gt; , a script, script tool, or notebook can simply loop through the Portals and make sure the user is signed into each portal.&amp;nbsp; If the user isn't signed in, a window pops up for them to finish the SAML login process for a given site.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pythonnet
pythonnet.load("coreclr")

import clr
clr.AddReference("ArcGIS.Desktop.Core")

from ArcGIS.Desktop.Core import ArcGISPortalManager
portal_manager = ArcGISPortalManager.Current
for portal in portal_manager.GetPortals():
    portal.SignIn()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;That's it, 3 lines of functional code and some import statement.&lt;/P&gt;&lt;P&gt;The native ArcPy equivalent is impossible because &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/signintoportal.htm" target="_blank" rel="noopener"&gt;SignInToPortal—ArcGIS Pro | Documentation&lt;/A&gt; chokes on handling the sign in for SAML logins.&amp;nbsp; Even if the function worked, it forces a change to the active portal, which isn't always desirable, so then you have to go back and reset the active portal.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Dec 2024 23:00:09 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2024-12-04T23:00:09Z</dc:date>
    <item>
      <title>ArcPy SignInToPortal Doesn't Handle SAML Logins But ArcGIS Pro SDK ArcGISPortal Class Does</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-signintoportal-doesn-t-handle-saml-logins/m-p/1564949#M90851</link>
      <description>&lt;P&gt;This question is primarily for Esri staff.&amp;nbsp; I am interested in understanding why the ArcPy ArcGIS Online/Portal functions are so limited compared to the ArcGISPortal and ArcGISPortalManager classes in the ArcGIS Pro SDK.&amp;nbsp; I assume both ArcPy and ArcGIS Pro SDK are hooking into the same underlying compiled code, so I know more can be done with ArcPy since I can do it with Pro SDK in Python using &lt;A href="https://github.com/pythonnet/pythonnet" target="_self"&gt;GitHub - pythonnet/pythonnet: Python for .NET&lt;/A&gt; .&lt;/P&gt;&lt;P&gt;One specific issue is how &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/signintoportal.htm" target="_blank" rel="noopener"&gt;SignInToPortal—ArcGIS Pro | Documentation&lt;/A&gt; either doesn't work or doesn't work correctly with SAML logins.&amp;nbsp; It is not uncommon in my organization to have users with lots of Portals registered in ArcGIS Pro, many of which are SAML-based logins.&amp;nbsp; When using Pro SDK with &lt;A href="https://github.com/pythonnet/pythonnet" target="_self"&gt;GitHub - pythonnet/pythonnet: Python for .NET&lt;/A&gt; , a script, script tool, or notebook can simply loop through the Portals and make sure the user is signed into each portal.&amp;nbsp; If the user isn't signed in, a window pops up for them to finish the SAML login process for a given site.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pythonnet
pythonnet.load("coreclr")

import clr
clr.AddReference("ArcGIS.Desktop.Core")

from ArcGIS.Desktop.Core import ArcGISPortalManager
portal_manager = ArcGISPortalManager.Current
for portal in portal_manager.GetPortals():
    portal.SignIn()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;That's it, 3 lines of functional code and some import statement.&lt;/P&gt;&lt;P&gt;The native ArcPy equivalent is impossible because &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/signintoportal.htm" target="_blank" rel="noopener"&gt;SignInToPortal—ArcGIS Pro | Documentation&lt;/A&gt; chokes on handling the sign in for SAML logins.&amp;nbsp; Even if the function worked, it forces a change to the active portal, which isn't always desirable, so then you have to go back and reset the active portal.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2024 23:00:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-signintoportal-doesn-t-handle-saml-logins/m-p/1564949#M90851</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2024-12-04T23:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy SignInToPortal Doesn't Handle SAML Logins But ArcGIS Pro SDK ArcGISPortal Class Does</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-signintoportal-doesn-t-handle-saml-logins/m-p/1567649#M91187</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1371"&gt;@JoshuaBixby&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;great find.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/190407"&gt;@JonahLay&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see this ArcGIS Pro idea is closed.&lt;/P&gt;&lt;P&gt;Based on Joshua's finding's above, is there a chance the idea can be reopened?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1027"&gt;@TedCronin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see you have a need for this here:&lt;BR /&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/pass-ad-login-from-arcgis-to-arcpy/td-p/852979" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-api-for-python-questions/pass-ad-login-from-arcgis-to-arcpy/td-p/852979&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tagging my comment here for other reference with this saml login issue:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-enterprise-questions/unable-to-generate-tokens-using-saml-enterprise/m-p/1509666/highlight/true#M40082" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-enterprise-questions/unable-to-generate-tokens-using-saml-enterprise/m-p/1509666/highlight/true#M40082&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 04:12:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-signintoportal-doesn-t-handle-saml-logins/m-p/1567649#M91187</guid>
      <dc:creator>AndresCastillo</dc:creator>
      <dc:date>2024-12-12T04:12:44Z</dc:date>
    </item>
  </channel>
</rss>

