The diagnosis of tuberculosis is based on the isolation of acid-fast bacilli (AFB) on direct examination or on the culture isolation of mycobacteria tuberculosis complex (MCT). Currently, the introduction of molecular biology, essentially the Xpert / MTB / Rif or GeneXpertR test has increased the sensitivity and speed of diagnosis. The objective of our study is the evaluation of the performance of the Xpert / MTB / Rif molecular technique in the diagnosis of pulmonary and extrapulmonary tuberculosis. This is a descriptive retrospective study over a period of 22 months (June 2016 - April 2018). The study concerned all pulmonary and extrapulmonary specimens sent to the laboratory of bacteriology-virology and molecular biology of the HMA Marrakech for suspicion of tuberculosis. Diagnosis was performed on all specimens by direct examination on Ziehl-Neelsen stained smears, culture on Loweinstein Jensen solid medium (LJ) and GeneXpert molecular technical. Our study included 305 patients, 69% were men and 31% women. The clinical samples included in the study consisted of different specimens with a prevalenceof sputum (n = 127). Positivity was higher for GeneXpert MTB / RIF than for Ziehl-Neelsen and culture with respectively 18% (n = 54) for GeneXpert against 13% (n = 40) for culture and 8% (n = 24) for Ziehl-Neelsen. On all positive direct examination specimens, GeneXpert was positive in 100% of cases, on negative direct examination samples, GeneXpert was positive in 5% of cases. The positivity rate of GeneXpert was 10.6% for samples with negative culture and 100% for positive culture samples. The performance of GeneXpert was variable depending on the nature of the samples: sputum (23%), biopsy (15%), pleural fluid (13%). Four cases of resistance to rifampicin have been detected. Our study shows the great contribution of GeneXpert for the diagnosis of pulmonary and extrapulmonary tuberculosis as well as its place in the determination of multidrug resistance.