code: public static String groupFromResourceId(String id) {
          return (id != null) ? ResourceId.fromString(id).resourceGroupName() : null;
      }
docs: Extract resource group from a resource ID string.
  @param id the resource ID string
  @return the resource group name