If you are anticipating rain while your bike is locked up, try to orient your lock in such way that water will run out of the lock cylinder. This may make it harder to access the keyhole, but it will help prevent corrosion.
The problem is worse in the winter, when my lock picks up some of the road salt, but I have made it a habit whenever I lock my bike. Speaking from personal experience, it is not fun spraying a lock with PB Blaster with the hope that my bicycle will be freed from a life of being locked to a bike rack.
If you use your lock on a daily basis, you probably don’t have much to worry about. But if you find that your bike is locked up outside for extended periods of time, make sure any water can run out of the lock cylinder!