I'm a viking, in the us army. And they told me that I was not allowed to grow my beard. Are they allowed to do that?
Or is my religious right let me grow.
The army is sovereign in internal affairs. You must fulfill every order unless it is "expressly" illegal, ie would be refused by majority of individuals on a moral basis. If you refuse an order, particularly in bootcamp, you'll be quickly prosecuted and punished (imprisoned or dismissed). You will never be exonerated in a military tribunal. The only way to sidestep regulations is through exception clauses (to which you won't be granted open access usually, other than as an enforcer). In this case, medical or religious, however only the particular ones specified in orders. Dishonest individuals will feign one or the other (eg by a congenial doctor, or inducing rash), but this won't incur favour.
This is a test, or a coercion, of your merit as a soldier. You may have the right to quit, and that's pretty much all you get in the long run.