In 1705 Sarro married a young music student, Caterina Tortorella. He lost his job as assistant royal music master in 1707, when Austria took over Naples. From 1707 until 1718, he composed mostly church music, oratorios and serenades. He started writing operas again in 1718 and became very famous. He was the first composer to use a libretto by Pietro Metastasio for an opera. The opera was about Dido, Queen of Carthage. It was called "". (Its title means "Dido " in Italian.) It was performed in Naples in 1724 and was a big success. Sarro got his job back as assistant royal music master in 1725. In 1728, he also became the official music master for the city of Naples.