Skip to content

Latest commit

 

History

History
120 lines (88 loc) · 8.92 KB

README.md

File metadata and controls

120 lines (88 loc) · 8.92 KB

Tenant Switcher for UiPath Studio logo Tenant Switcher for UiPath Studio logo

Tenant Switcher for UiPath Studio

By Søren Schytz Birk

Tenant Switcher for UiPath Studio is a Studio extension that switches the local UiPath Robot and Assistant between Orchestrator tenants in one step. It uses saved presets, each with an Orchestrator URL, a machine client ID and a client secret. It was formerly called Orchestrator Connector.

Its sibling, the Windows app Tenant Switcher for UiPath, does the same outside Studio. The two share their presets and both show the tenant the Robot is actually connected to.

Install

  • UiPath Studio 26.0.195 or later on Windows. That is the first version with extension support.
  • Download sorenb-studio-tenant-switcher-<version>.vsix from Releases.
  • In Studio, open Extensions → Custom and select the file.
  • You also need a machine in Orchestrator that uses client ID / client secret credentials, either a machine template or a standard machine.

Upgrading from Orchestrator Connector 0.1.0: uninstall it first. Your presets and secrets are kept.

Quick example

  1. Open Tenant Switcher in the activity bar.
  2. Select Add preset and fill in the form:
    • Name: Acme production
    • URL: https://cloud.uipath.com/acme/Production/orchestrator_
    • The machine's client ID and client secret.
    • Select Test to check the credentials, then Save.
  3. Select the tenant name in the status bar. Pick Acme production, and confirm.
  4. The Robot reconnects. Studio reloads its extensions, then reports Connected to 'Acme production'.

Reference

Panel

The Tenant Switcher panel in the activity bar lists your presets. Each preset has its own card:

Action Where
Add a preset Add preset at the top of the panel opens a form with all fields
Connect Connect on a preset card, or the tenant name in the status bar
Edit the pencil icon on a card. Leave the client secret blank to keep the stored one.
Test credentials Test in the form. It requests a token with the values entered, without touching the Robot.
Delete the bin icon on a card. The stored secret is removed too.

Confirmations appear on the preset card. For example, Do you want to switch tenant to Staging? comes with Switch and Cancel. Selecting a tenant from the status bar list counts as the confirmation.

Switch results appear as a banner at the top of the panel, with Show log and OK. Studio titles every extension message box "Extension", so the panel is used wherever possible.

The connected preset has a violet border and a green Connected label. Hover over a card to see its full URL and client ID.

The connected preset is read from Studio's live connection, or else from the Robot's own UiPath.settings, so it is correct whichever tool made the switch. The panel and status bar update live when that file changes, so a switch made in the desktop app shows up here too.

What a switch does

  1. Checks the credentials. The extension requests a client_credentials token from the tenant's Identity Server. If the credentials are rejected, nothing changes. If Identity Server cannot be reached, the card offers Switch anyway.
  2. Disconnects. Closes UiPath Assistant and runs UiRobot disconnect. If you chose Turn off and switch (see Troubleshooting), Assistant's Show in Windows Start Menu is turned off while Assistant is closed.
  3. Connects. Runs UiRobot connect --url … --clientId … --clientSecret … and checks the exit code. If the connect fails, the tenant the Robot was connected to before is reconnected.
  4. Restarts the UiPath Robot Windows service, but only if one exists (service-mode installs). Windows asks for elevation. Per-user installs skip this step.
  5. Starts UiPath Assistant again.
  6. Signs in the uip CLI (optional, per preset). Runs uip login with the same client credentials so the UiPath CLI targets the same tenant.

Studio restarts its extension host when the tenant changes. Steps 2–6 therefore run in a separate PowerShell process, started through WMI, outside Studio's process tree. The extension reports the result once it is running again. Each step is logged in the Tenant Switcher output channel and in switch.log in the extension's global storage folder.

Settings

Setting Default Description
tenantSwitcher.uiRobotPath (empty) Full path to UiRobot.exe. Empty: detect the per-user UiPath Platform install, then Program Files.
tenantSwitcher.restartAssistant true Closes UiPath Assistant before the switch and starts it afterwards.
tenantSwitcher.validateBeforeSwitch true Tests the credentials against Identity Server before disconnecting.
tenantSwitcher.confirmBeforeSwitch true Asks for confirmation before switching.
tenantSwitcher.warnAboutStartMenuShortcuts true Warns before switching when Assistant's Show in Windows Start Menu is on. See Troubleshooting.
tenantSwitcher.uipCliPath uip The uip command or its full path.

Storage

Data Location
Presets (name, URL, client ID) %AppData%\OrchestratorConnector\presets.json
Client secrets Windows Credential Manager, target OrchestratorConnector:<preset id>
uip sync option per preset preset-meta.json in the extension's global storage
Connected tenant (read only) the Robot's UiPath.settings, key UiPathServerUrl: %AppData%\UiPath (user mode) or %ProgramData%\UiPath (service mode)
Assistant's Start menu setting %AppData%\UiPath\agent-settings.json, key agent.showStartMenuShortcuts. Read before each switch; changed only when you choose Turn off and switch.

The preset and secret locations keep the OrchestratorConnector name on purpose. They are shared with the Tenant Switcher for UiPath desktop app, so a preset created in one tool appears in the other. The list reloads when the file changes. The uip sync option is stored per tool.

Security

  • Client secrets are stored only in Windows Credential Manager.
  • Secrets pass between the extension and its helper scripts over standard input, never on a command line.
  • Exception: UiRobot.exe accepts the client secret only as a command-line argument. While UiRobot connect runs, any local process that can read other processes' command lines can see it.

Troubleshooting

Windows Explorer stops responding after a switch. Win+E, Alt+Tab and taskbar clicks do nothing, and File Explorer windows don't open. This happens when UiPath Assistant's Preferences → Show in Windows Start Menu is on. Assistant keeps one Start menu shortcut per automation and rewrites them all when it connects to another tenant. With access to many folders that is hundreds of shortcuts, and Windows Explorer can stop handling input while it processes them.

  • Fix: turn off Show in Windows Start Menu in Assistant. When it is on, the panel warns before a switch and offers Turn off and switch, which changes that one setting while Assistant is closed. When tenantSwitcher.restartAssistant is off, change it in Assistant yourself.
  • Once Explorer has frozen: restart Windows Explorer from Task Manager.
  • Turning the setting off makes Assistant remove its shortcuts, which can freeze Explorer once more.
  • To keep the setting and stop the warning, turn off tenantSwitcher.warnAboutStartMenuShortcuts.

Development

npm install
npm run build      # bundle to dist/ with esbuild
npm test           # vitest; Credential Manager and switch.ps1 end-to-end tests run on Windows
npm run package    # create the .vsix

Releases: pushing a v* tag that matches the package.json version makes CI test and package the extension, create the GitHub release with the .vsix, and publish it to Open VSX. Open VSX trusts ci.yml (trusted publishing), so no token is stored. To publish an existing tag to Open VSX again, run the CI workflow manually (Run workflow) with that tag.

Changelog

See CHANGELOG.md.

License

MIT. See LICENSE.


By Søren Schytz Birk · UiPath Community MVP · github.com/sorenbcoding

Tenant Switcher for UiPath Studio is an independent open-source project by Søren Schytz Birk (github.com/sorenbcoding) and is not affiliated with, endorsed by, or sponsored by UiPath. UiPath and related names are trademarks of UiPath Inc.