The Waterdeep: Dragon Heist adventure (in a sidebar on p. 6) gives details of
In it, it states:
Waterdeep is blanketed by an undispellable magical effect called Ahghairon’s dragonward. The effect originates from somewhere under Ahghairon’s Tower in the Castle Ward and is permanent. Dragons and all other creatures of the dragon type are physically unable to enter the city (or its sewers) as long as the dragonward persists. The effect doesn’t extend to the harbor or into Undermountain.
Of specific interest are the way(s) a dragon can get permission:
A creature of the dragon type that is touched by the dragonstaff of Ahghairon (see appendix A) can ignore Ahghairon’s dragonward and move through the city freely. The effect lasts until the creature is touched again by the staff, or until the passage of a period of time specified by one who is attuned to the staff.
This makes it pretty clear that a dragon who has been so permitted may move through the city freely. It leaves silent what happens to a dragon who has this permission rescinded while they are still in the city.
Is there any lore from previous editions or elsewhere that describes what happens in such an event?