Leave it alone until you can take it out. You'll want troops with fire resistance cloaks, and ideally Nature's Cloak (Earth spell), otherwise the dragon will kill everyone with its breath, as you found out. It may kill a city or two but there's no point losing armies as well as cities by attacking it with armies which are too weak.
Assuming you have fire resistance you'll then want either lots of strong units (warg ice staff troops would be nice if you have them available), and/or a strong mage. Shadowbolts and Kill should do the trick if you have a high initiative Death archmage and enough mana. Tactically summoning a Grave Elemental to give all units within one tile resurrection (Death Ward) is very helpful. Summon Skeleton Horde can be surprisingly effective by giving swarm bonuses and getting the dragon to use attacks killing skeletons. A buffed Lightbringer or hero can probably survive if you put it on defend and it has Nature's cloak, allowing you to attack with other troops (such as ice staffs). Evade, stoneskin, gift of iron or diamondskin would help. Growth can help your troops do some damage. Shrink and Syphon Strength would help, but generally you don't want resistible spells against high magic resistance targets, so that also rules out Slow, Curse, Blindness, unless you have a very high spell mastery mage or you want to cast a few shadowbolts. Haste is always helpful, cast it on your mage as early as you can. Healing spells may be helpful if your troops survive the first attacks. Buying blizzard scrolls and potions for your heroes would help. Strategic spells Wither and Freeze would be helpful, or Tremor if you just want to stop the dragon doing damage to your kingdom.
Hope some of that works for you. I had a similar experience in one of my early games where I got smashed by a quest Dark Sorcerer, it was ages before I had a strong enough army to kill him, but he didn't actually do too much damage while wandering through my kingdom randomly.