code: protected Authenticated getAuthObjFromAzureCli() {
          try {
              final Azure.Configurable azureConfigurable = azureConfigure();
              final Authenticated auth;
              if (isInCloudShell()) {
                  getLog().info(AUTH_WITH_MSI);
                  auth = azureConfigurable.authenticate(new MSICredentials());
              } else {
                  getLog().info(AUTH_WITH_AZURE_CLI);
                  auth = azureConfigurable.authenticate(AzureCliCredentials.create());
              }
              return auth;
          } catch (Exception e) {
              getLog().debug(AZURE_CLI_AUTH_FAIL);
              getLog().debug(e);
          }
          return null;
      }
docs: Get Authenticated object using authentication file from Azure CLI 2.0
  
  Note: The integrated Azure CLI in Azure Cloud Shell does not have the accessToken.json,
  so we need to use MSI to authenticate in the Cloud Shell.
  
  @return Authenticated object if Azure CLI 2.0 is logged in correctly; otherwise return null.