The Machine Key Used To Connect Is Not In The Same Tenant As The Logged In User

When trying to activate Studio, the following error is returned "The machine key used to connect is not in the same tenant as the logged in user".

Issue Description:

Users attempting to connect a Robot or Studio to the Orchestrator may encounter an error message indicating a conflict between the machine key and the logged in user. The error states, "The machine key used to connect is not in the same tenant as the logged in user".

Error message from Event Viewer:

UiPath.Service.UserHost 22.10.3.0 
[Http Status 409][Orchestrator Error Code 1229]UiPath.Service.Orchestrator.Clients.OrchestratorHttpException: The machine key used to connect is not in the same tenant as the logged in user.
   at UiPath.Service.Orchestrator.OrchestratorClientExtensions.EnsureOrchestratorStatusCodeAsync(HttpResponseMessage response)
   at UiPath.Service.Orchestrator.Clients.OrchestratorBaseClient.InternalRequestAsync[T](String baseUrl, String serviceUrl, HttpMethod method, HttpContent content, Func`2 parseResponse, TokenFactory tokenFactory, TimeSpan timeout, Dictionary`2 headers, CancellationToken ct)
   at UiPath.Service.Orchestrator.Clients.OrchestratorBaseClient.RequestAsync(String baseUrl, String serviceUrl, HttpMethod method, HttpContent content, TokenFactory tokenFactory, TimeSpan timeout, Dictionary`2 headers, CancellationToken ct)
   at UiPath.Service.Orchestrator.Clients.OrchestratorBaseClient.RequestAsync[T](String baseUrl, String serviceUrl, HttpMethod method, HttpContent content, TokenFactory tokenFactory, TimeSpan timeout, Dictionary`2 headers, CancellationToken ct)
   at UiPath.Service.Orchestrator.Clients.OrchestratorClient.BeginSession(RobotIdentifier robotIdentifier, CancellationToken ct), HResult -2146233088


Root Cause:

This issue arises when the Robot agent is signed into one Tenant, but the Client ID/Machine Key used in Orchestrator Settings on UiPath Assistant belongs to a different Tenant.
image.png


Resolution:

Follow the steps below to rectify this issue:

  1. Open the UiPath Assistant.
  2. Navigate to the Preferences and find the 'Orchestrator Settings'.
  3. Click 'Sign out' first (if you are signed in) and then click on 'Disconnect'.
  4. Connect back using the Client ID & Secret/Machine key from the Orchestrator Tenant you want to use.


Notes:

  • To connect as an 'Unattended' Bot, avoid signing in.
  • To connect as an 'Attended' Bot, click on Sign In. Before clicking on Sign In, make sure that the user is either signed out from the Orchestrator in the browser or the user is signed into the same Tenant from which the Client ID & Secret are used to connect the Robot.