Some cyanobacteria can take up nitrogen from the air (well, dissolved inorganic nitrogen), but many can only use organic nitrogen, like N03 or NH4. Those can be limiting in the ocean because lots of life wants to grab it up.
Taking up inorganic nitrogen is called nitrogen fixation and takes a bunch of machinery and energy. Also, oxygen inhibits the process, so for photosynthetic bacteria a bunch of extra steps have to be taken to compartmentalize photosynthesis and nitrogen fixation. So not all cyanobacteria can do it, and even the ones who are able to will prefer to take up organic nitrogen if available, and they grow slower when they have to use N2.