High quality CCD detectors are now being produced with 2048 x 4096 square pixels, each 15 mum on a side. Even larger detector areas are built with several CCDs mounted into a mosaic. To be useful in an instrument the light must be in focus on all CCDs, requiring that all CCDs in a mosaic must typically be aligned within 30 micron of a flat plane. To achieve this accuracy in many cases the measurement and correction of the CCD alignment is necessary. One way allowing a surface measurement, even when the CCD is protected by a window, is to use triangulation sensor. The principle of a triangulation sensor, its application and its implementation in a measuring machine are presented here.