You can get your residence visa and live in the UAE legally.
A residence visa or permit is basically a document that proves an expat is allowed to stay in any emirate of the country for a set amount of time, according to the UAE's immigration rules. The government sets various conditions for granting residency, like for business, investing, visiting, or studying, and these conditions determine the type and duration of the visa.