PRIMARY OBJECTIVES:
      I. To determine the maximum tolerated dose (MTD) and dose limiting toxicity (DLT) of avelumab
      in combination with azacitidine (5-azacytidine) in patients with refractory/relapsed acute
      myeloid leukemia (AML). (Phase IB)
      II. To determine the overall response rate (ORR) defined as complete remission (CR)/complete
      remission with incomplete platelet recovery (CRp)/complete remission with incomplete count
      recovery (CRi)/partial remission (PR)/hematologic improvement (HI)/morphologic leukemia free
      state (MLFS) of avelumab in combination with 5-azacytidine in patients with
      refractory/relapsed AML. (Phase II
      SECONDARY OBJECTIVES:
      I. To determine the number of patients achieve > 50% reduction in blasts on therapy with this
      combination.
      II. To determine the duration of response, disease-free survival (DFS), and overall survival
      (OS) of patients with refractory/relapsed AML treated with this combination
      TERTIARY OBJECTIVES:
      I. To study immunological and molecular features at baseline and at predefined time-points
      on-therapy with avelumab and azacytidine in the peripheral blood and bone marrow to include
      quantify immune ligand expression by the AML blasts and AML stromal components
      (myeloid-derived suppressor cells [MDSCs] and mesenchymal stem cells [MSCs]) including
      4-1BBL, ICOSL, PD-L1, PD-L2, OX-40L, CD137L.
      II. To study immunological and molecular features at baseline and at predefined time-points
      on-therapy with avelumab and azacytidine in the peripheral blood and bone marrow to determine
      the quantitative expression of positive and negative co-stimulatory molecules on individual
      T-lymphocyte subsets including 4-1BB, CTLA-4, ICOS, PD-1, OX40, LAG-3 and TIM-3.
      III. To study immunological and molecular features at baseline and at predefined time-points
      on-therapy with avelumab and azacytidine in the peripheral blood and bone marrow to identify
      the immunophenotype of tumor-infiltrating T-lymphocytes (TILs) pre- and post-therapy with the
      combination: CD8+, CD4+ effector, or CD4+ regulatory.
      IV. To develop a micro-array based gene expression profile (GEP) predictor of response to
      anti-PDL1 and epigenetic therapy in AML.
      V. To determine the correlation of responses to the combination with baseline cytogenetic and
      molecular abnormalities
      OUTLINE: This is a phase Ib, dose-escalation study of avelumab followed by a phase II study
      Patients receive azacitidine subcutaneously (SC) or intravenously (IV) over 10-40 minutes on
      days 1-7 or on days 1-5 and 8-9. Patients also receive avelumab IV over 60 minutes on days 1
      and 14 for 4 courses (or until complete response) and on day 1 for subsequent courses.
      Courses repeat every 28 days in the absence of disease progression or unacceptable toxicity
      After completion of study treatment, patients are followed up every 3-6 months for up to 5
      years.
    
        Inclusion Criteria:
          -  Patients with AML who are refractory (up to salvage 2) or relapsed (up to 2nd
             relapse); for patients with prior myelodysplastic syndrome (MDS) or chronic
             myelomonocytic leukemia (CMML) or myeloproliferative neoplasm (MPN) who transformed to
             AML, therapy received for MDS, CMML, or MPN is NOT considered as prior therapy for AML
          -  Prior therapy with hydroxyurea, chemotherapy, biological or targeted therapy (e.g.
             FLT3 inhibitors, other kinase inhibitors), or hematopoietic growth factors is allowed
          -  Eastern Cooperative Oncology Group (ECOG) performance status =< 2
          -  Total bilirubin =< 1.5 times upper limit of normal (x ULN) (=< 3 x ULN if considered
             to be due to leukemic involvement or Gilbert's syndrome)
          -  Aspartate aminotransferase or alanine aminotransferase =< 2.5 x ULN (=< 5.0 x ULN if
             considered to be due to leukemic involvement)
          -  Estimated creatinine clearance >= 30 mL/min according to the Cockcroft-Gault formula
             (or local institutional standard method)
          -  Patients must provide written informed consent
          -  In the absence of rapidly progressing disease, the interval from prior treatment to
             time of initiation of 5-azacytidine and avelumab will be at least 14 days OR at least
             5 half-lives for cytotoxic/noncytotoxic agents, whichever is longer; the toxicity from
             prior therapy should have resolved to grade =< 1, however alopecia and sensory
             neuropathy grade =< 2 is acceptable; the half-life for the therapy in question will be
             based on published pharmacokinetic literature (abstracts, manuscripts, investigator
             brochures, or drug-administration manuals) and will be documented in the protocol
             eligibility document; use of hydroxyurea for patients with rapidly proliferative
             disease is allowed before the start of study therapy and will not require a washout;
             concurrent therapy for central nervous system (CNS) prophylaxis or continuation of
             therapy for controlled CNS disease is permitted; patients with CNS disease or leukemic
             brain metastasis must have been treated locally and be clinically stable for at least
             2 weeks prior to enrollment and have no ongoing neurological symptoms that are related
             to the CNS disease (sequelae that are a consequence of the treatment of the CNS
             disease are acceptable)
          -  Females must be surgically or biologically sterile or postmenopausal (amenorrheic for
             at least 12 months) or if of childbearing potential, must have a negative serum or
             urine pregnancy test within 72 hours before the start of the treatment
          -  Women of childbearing potential must agree to use an adequate method of contraception
             during the study and until 3 months after the last treatment; males must be surgically
             or biologically sterile or agree to use an adequate method of contraception during the
             study until 3 months after the last treatment; adequate methods of contraception
             include:
               -  Total abstinence when this is in line with the preferred and usual lifestyle of
                  the patient; periodic abstinence (e.g., calendar, ovulation, symptothermal,
                  post-ovulation methods) and withdrawal are not acceptable methods of
                  contraception
               -  Female sterilization (have had surgical bilateral oophorectomy with or without
                  hysterectomy) or tubal ligation at least six weeks before taking study treatment;
                  in case of oophorectomy alone, only when the reproductive status of the woman has
                  been confirmed by follow up hormone level assessment
               -  Male sterilization (at least 6 months prior to screening); for female patients on
                  the study, the vasectomized male partner should be the sole partner for that
                  patient
               -  Combination of any of the two following (a+b or a+c or b+c)
                    -  a. Use of oral, injected or implanted hormonal methods of contraception or
                       other forms of hormonal contraception that have comparable efficacy (failure
                       rate < 1%), for example hormone vaginal ring or transdermal hormone
                       contraception
                    -  b. Placement of an intrauterine device (IUD) or intrauterine system (IUS)
                    -  c. Barrier methods of contraception: condom or occlusive cap (diaphragm or
                       cervical/vault caps) with spermicidal foam/gel/film/cream/ vaginal
                       suppository In case of use of oral contraception, women should have been
                       stable on the same pill before taking study treatment
               -  Note: oral contraceptives are allowed but should be used in conjunction with a
                  barrier method of contraception due to unknown effect of drug-drug interaction
          -  Women are considered post-menopausal and not of child bearing potential if they have
             had 12 months of natural (spontaneous) amenorrhea with an appropriate clinical profile
             (e.g. age appropriate, history of vasomotor symptoms) or have had surgical bilateral
             oophorectomy (with or without hysterectomy) or tubal ligation at least six weeks ago;
             in the case of oophorectomy alone, only when the reproductive status of the woman has
             been confirmed by follow up hormone level assessment is she considered not of child
             bearing potential
        Exclusion Criteria:
          -  Patients with a known allergy or hypersensitivity to avelumab, 5-azacytidine, or any
             of their components; known severe hypersensitivity reactions to monoclonal antibodies
             (grade >= 3 National Cancer Institute [NCI] Common Terminology Criteria for Adverse
             Events [CTCAE] version [v] 4.03), any history of anaphylaxis, or uncontrolled asthma
             (that is, 3 or more features of partially controlled asthma)
          -  Patients with a known history of severe interstitial lung disease or severe
             pneumonitis or active pneumonitis/pneumonia or pulmonary pathology that is not well
             controlled in the opinion of the treating physician and/or principal investigator (PI)
          -  Patients who have previously been treated with avelumab (or another PD1/PDL1
             inhibitor) in combination with 5-azacytidine will be excluded
          -  Persisting toxicity related to prior therapy of grade > 1 NCI-CTCAE v 4.03; however,
             alopecia and sensory neuropathy grade =< 2 is acceptable
          -  Active autoimmune disease that might deteriorate when receiving an immunostimulatory
             agent: a) subjects with diabetes type I, vitiligo, psoriasis, hypo- or hyperthyroid
             disease not requiring immunosuppressive treatment are eligible; b) subjects requiring
             hormone replacement with corticosteroids are eligible if the steroids are administered
             only for the purpose of hormonal replacement and at doses =< 10 mg or 10 mg equivalent
             prednisone per day; c) administration of steroids through a route known to result in a
             minimal systemic exposure (topical, intranasal, intro-ocular, or inhalation) are
             acceptable
          -  Patients with organ allografts (such as renal transplant) are excluded
          -  Patients who are < 90 days post allogeneic stem cell transplant will be excluded;
             patients beyond 90 days post-allogeneic stem cell transplant with active uncontrolled
             graft versus host disease (GVHD) > grade 1 will be excluded; patients who are on a
             stable dose of immunosuppressive therapy (tacrolimus, cyclosporine, or other) for > 2
             weeks will be eligible but those with recent increase in the immunosuppressive
             medication dose within last 2 weeks to control GVHD will not be included; Note:
             subjects may be using systemic corticosteroids or topical or inhaled corticosteroids
             post allogeneic stem cell transplant; patients requiring >= 1 mg/kg prednisone for
             GVHD management at the time of screening will not be eligible until the prednisone can
             be weaned to < 1 mg/kg; such patients should be monitored for at least 14 days and if
             no flare of GVHD requiring re-escalation of steroids or additional interventions for
             the GVHD they will be eligible
          -  Patients with symptomatic CNS leukemia or patients with poorly controlled CNS leukemia
          -  Active and uncontrolled disease/(active uncontrolled infection, uncontrolled
             hypertension despite adequate medical therapy, active and uncontrolled congestive
             heart failure New York Heart Association [NYHA] class III/IV, clinically significant
             and uncontrolled arrhythmia) as judged by the treating physician
          -  Patients with known human immunodeficiency virus seropositivity will be excluded
          -  Known to be positive for hepatitis B by surface antigen expression; known to have
             active hepatitis C infection (positive by polymerase chain reaction or on antiviral
             therapy for hepatitis C within the last 6 months)
          -  Any other medical, psychological, or social condition that may interfere with study
             participation or compliance, or compromise patient safety in the opinion of the
             investigator
          -  All other significant diseases (for example, inflammatory bowel disease, uncontrolled
             asthma), which, in the opinion of the investigator, might impair the subject's
             tolerance of trial treatment
          -  Patients unwilling or unable to comply with the protocol
          -  Pregnant or breastfeeding
          -  Known alcohol or drug abuse within the last 1 year
          -  Vaccination within 4 weeks of the first dose of avelumab and while on trial is
             prohibited except for administration of inactivated vaccines
          -  Acute promyelocytic leukemia (APL)
          -  Subject has a history of other malignancies prior to study entry, with the exception
             of: adequately treated in situ carcinoma of the cervix uteri or carcinoma in situ of
             breast; basal cell carcinoma of the skin or localized squamous cell carcinoma of the
             skin; previous malignancy confirmed and surgically resected (or treated with other
             modalities) with curative intent or completed definitive therapy (chemotherapy,
             radiation, others) for the malignancy at least 1 year prior to the date of screening