"It was sunny in Beijing yesterday."
I believe both should be accepted. I live in China and have just asked all my friends who say both are accepted, but note they said orally. Some tried to find a grammar rule to explain it but to no avail. Perhaps the rule in writing is different. I will continue to look for a answer here.
I think the order matters here. 北京昨天是晴天, i.e. 北京的昨天是晴天, means that "the yesterday OF Beijing was a sunny day". If you reverse it, 昨天北京是晴天, that would be "the Beijing OF yesterday was a sunny day".
You see why it is only correct in the first way. A day can be sunny, but Beijing cannot be sunny.
I guess you have to choose the subject of the sentence, 北京 or 昨天. If 北京 is the subect, then it has to be placed at the beginning of the sentence following the SVO rule. if 昨天 is the subject, it has to be placed at the begining of the sentence. The sentence is focuses on its subject. I guess here the sentence is deemed to be focused on the location, i.e. 北京