blcli_setoption can't change things once the connection to the appserver is created. so the Utility.assumeRole is the way to switch roles after you have connected to the appserver. also, if this is running as a nsh script job, you don't need any of these:
blcli_setoption authType BLSSO
blcli_setoption serviceProfilesFile /bladelogic/depot/shared/AD_SYNC/profile.xml
blcli_setoption serviceProfileName SRP_Profile
blcli_setoption roleName SA_BL_USER # this is a BLADmins role equivalent
blcli_connect || exit 2
as they are ignored.
You can create an 'idea' to have the 'Utility.assumeRole' made into a 'released' blcli command.
It was designed to be dual-purpose posix/CLI executable as well as NSH batch/script job capable, fyi. Do you think the Utility class method will be future compatible?
That command has existed for atleast 8 years..i don’t see that changing anytime soon.