Train, train, train! Reward calm behavior, ignore barking. Train a go to mat command where he lays down on an area rug calmly. Train a quiet command by waiting until he stops barking, immediately say "quiet" and treat. Then you can command him to stop barking after the initial barking. Alarm barking isn't without its uses.
Some people will suggest various collars and other corrections. I feel this is cruel. Dogs bark. Punishing a dog for barking is like punishing a baby for crying. They don't have words, they have barks. Plus, at 7 months, your pup could be in a fear stage. If he's barking out of fear and you use a punishment, you could seriously mess him up.