If you want to protect the entire subdomain, and you are on a Linux server running Apache, then you would use the following technique.
Password Protect a Directory with .htaccess - Web Development in Brighton - Added Bytes
This will not work on a Microsoft server. The.htaccess file with password script goes in the root of the subdomain you wish to protect. Make sure that you use the correct server path to the .htpasswd file. You also need to encrypt the password in the .htpasswd file. Everything you need is on the page in that article.
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." -- Benjamin Franklin