code: private void isUserLoggedIn() {
          String accountListCmd = azureCli.getLoggedInAccountList();
          Pair<Integer, InputStream> result = executeCommand(accountListCmd);
          if (result.getKey() == 0) {
              try {
                  String accountList = IOUtils.toString(result.getValue(), StandardCharsets.UTF_8.name());
  
                  JSONArray jsonArray = new JSONArray(accountList);
                  for (int i = 0; i < jsonArray.length(); i++) {
                      JSONObject jsonObject = jsonArray.getJSONObject(i);
                      String loggedInUserName = jsonObject.getJSONObject("user").getString("name");
                      if (loggedInUserName.equalsIgnoreCase(config.getAzureUserName())) {
                          loggedInToAzure = true;
                          break;
                      }
                  }
              } catch (IOException e) {
                  logger.warn("Failed to parse command {} result. Exception: {}", accountListCmd, e.getMessage());
                  logger.debug("Failed to parse command {} result. Exception: {}", accountListCmd, e.getStackTrace());
              }
          } else {
              logger.warn("Failed to get Azure logged in account list, command: {}.", accountListCmd);
          }
      }
docs: Get Azure logged in users account list.
  Check if user logged in. If true then set 'loggedInToAzure' to true and UA will not Login/Logout account.