Preheat an oven to 180 degrees C. Grease a 22x33cm baking dish.
Heat the olive oil in a large frypan over medium heat; cook and stir the grated potato and onion in the hot oil until the potatoes begin to brown, about 5 minutes. Season with salt and pepper. Add the asparagus and ham and continue cooking until the asparagus is tender, another 5 to 7 minutes; transfer to the prepared baking dish. Whisk the eggs and milk together in a small bowl; pour evenly over the dish. Scatter the mozzarella and Cheddar cheese over the top of the potato mixture.
Bake in the preheated oven until set in the middle, 20 to 25 minutes. Garnish with the basil to serve.