It is developed when a host is exposed to antigens (living or dead microbes/proteins) and antibodies are produced in the host body (both in primary and secondary immune response). Active immunity is slow and takes time to give its full effective response. It can be developed by injecting the microbes or by the natural entry of infectious organisms into the body.
Example: During Vaccination and Immunisation.