Vitamin D is important, but generally just a little time spent outdoors is sufficient to avoid deficiencies. If you are a healthy person who regularly goes outdoors, your vitamin D production is sufficient so that you should not worry to avoid too much sun.
Vitamin D is produced in the skin when exposed to sunlight, and it is important to maintain strong bones and teeth. It may have several other beneficial health effects (e.g. increasing cardiovascular health, reducing blood pressure, and reducing your risk of several types of cancer).
Vitamin D is produced very quickly in the skin upon sunlight exposure; you don’t need to seek extra exposure to maintain your vitamin D levels. For example, being outside daily at noon time for about 10-15 minutes in spring and summer (with your face, arms and legs unprotected) is usually enough to produce sufficient vitamin D.
Following the recommendations to avoid too much sun and not to use sunbeds will protect you from too much damage to your skin but will not result in a shortage of vitamin D. In winter or at high latitudes you may prolong your time outside (but watch the UV index, also in winter) or choose a diet with higher vitamin D (e.g. cod liver oil, more (fatty) fish, egg yolk, offal such as liver). The use of sunbeds to increase your vitamin D level is unnecessary and is strongly discouraged because of the associated increased risk of skin cancer.
If you are still worried about a possible vitamin D deficiency, consult your physician for advice.
If you are suffering from a vitamin D deficiency, ask your physician for advice (e.g. for vitamin D supplementation or other treatments).