I have built a tool that uploads/overwrites hosted feature layers on enterprise portal on a weekly basis. The tool works fine, but the share with organization is not being recognized. The UploadServiceDefinition help states you must be signed into portal, so I included portal sign in in my script.
I set the in_organization parameter to "SHARE_ORGANIZATION" however, when my model runs it is not sharing with the organization.
This image shows my script successfully ran and I was signed into portal, and my sharing parameter was correctly set to SHARE_ORGANIZATION:

the actual script collects the parameter as input in a variable called share_organization (which can be set to SHARE_ORGANIZATION or NO_SHARE_ORGANIZATION per the ESRI documentation).
The upload command is here (uses the else clause in this particular case):

Parameters collected here:

I've been wracking my brain over this one...I have a similar script that publishes referenced registered data with similar settings and the share with organization part of the script (identical to this only on a federated server) works fine there.
Anybody have any idea why this is not working!?