International audienceThe production of prompt $\Lambda^+_\mathrm{c}$ baryons is measured via the exclusive decay channel $\Lambda^+_\mathrm{c}\to$ pK$^-\pi^+$ at a center-of-mass energy per nucleon pair of 5.02 TeV, using proton-proton (pp) and lead-lead (PbPb) collision data collected by the CMS experiment at the CERN LHC. The pp and PbPb data were obtained in 2017 and 2018 with integrated luminosities of 252 and 0.607 nb$^{-1}$, respectively. The measurements are performed within the $\Lambda^+_\mathrm{c}$ rapidity interval $\vert y\vert \lt$ 1 with transverse momentum ($p_\mathrm{T}$) ranges of 3-30 and 6-40 GeV/$c$ for pp and PbPb collisions, respectively. Compared to the yields in pp collisions scaled by the expected number of nucleon...