code: public static MSICredentials getMSICredentials(String managementEndpoint) {
          //check if we are running in a web app
          String websiteName = System.getenv("WEBSITE_SITE_NAME");
  
          if (websiteName != null && !websiteName.isEmpty()) {
              // We are in a web app...
              MSIConfigurationForAppService config = new MSIConfigurationForAppService(managementEndpoint);
              return forAppService(config);
          } else {
              //We are in a vm/container
              MSIConfigurationForVirtualMachine config = new MSIConfigurationForVirtualMachine(managementEndpoint);
              return forVirtualMachine(config);
          }
      }
docs: This method checks if the env vars "MSI_ENDPOINT" and "MSI_SECRET" exist. If they do, we return the msi creds class for APP Svcs
  otherwise we return one for VM
  
  @param managementEndpoint Management endpoint in Azure
  @return MSICredentials