Pinning of a rough interface by an external potential