I am trying to create a map service definition file in Python (see a snippet below). The code fails on the line arcpy.SignInToPortal:
arcpy.SignInToPortal("****", "****", "****")
File "D:\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 2468, in SignInToPortal
return _SignInToPortal(*args, **kwargs)
ValueError: Failed to sign out.
I confirmed that I am not logged in to the portal on the machine which the script is executed. The portal URL and the user credentials are correct as well. Why am I getting the error and how to get around it? Thanks!
----------------------------------------------------------------------------------------
arcpy.SignInToPortal(portalURL, "MyUserName", "MyPassword")
sharingDraft = mp.getWebLayerSharingDraft("HOSTING_SERVER", "FEATURE", serviceName)
sharingDraft.portalURL = portalURL
sharingDraft.portalFolder = serviceFolderName
sharingDraft.description = newDescription
sharingDraft.summary = "[Summary]"
sharingDraft.tags = "[Tags]"
sharingDraft.credits = "[Credits]"
sharingDraft.useLimitations = "[Limitations]"
sharingDraft.copyDataToServer = False
sharingDraft.exportToSDDraft(sdDraftFilePath)
arcpy.StageService_server(sdDraftFilePath, sdOutputFilePath)