If you retrive this publicipaddress attribute before the vm is ready, not may not be populated.