 During the early part of his long diplomatic career, he held, among other offices, those of canon of the Vatican Basilica, Prefect of archives in the Castle of San Angelo, Secretary of the Sacred College and Assessor of the Holy Office.He was created Cardinal Priest of Santa Sabina by Pope Pius VI in the consistory of 24 April 1775, and later Dean of the Sacred College and Cardinal Bishop of Ostia-Velletri.At the time of the French Revolution, with a view to preventing the suspension of church services, he lent his support to the vote for the civil constitution of the French clergy, decreed by the National Assembly of France (12 July 1790).