Maritime transport is responsible for producing a considerable amount of environmental pollution due to the reliance of ports and ships on the carbon-based energy sources. With the increasing trend towards port electrification to reduce carbon emissions, the operation of ports will be increasingly relying on the electricity network. This interconnection creates multiple challenges due to the complexity of power flow in the port network, uncertainty of vessel arrival time and fluctuation of power generation of renewable energy sources. These uncertainties can lead to an overload in electricity networks and delays in cargo-handling activities, resulting in increased vessel handling times and environmental emissions. This paper presents a joint logistics-electric framework for optimal operation and power management of electrified ports, considering multiple uncertainties in the arrival time of vessels, network demand, and renewable power generation. An optimal power flow method is developed for a real-life port, with consideration for multiple port logistic assets such as cargo handling equipment, reefers, and renewable energy sources. The proposed model ensures feasible port operation for all uncertainty realisations defined by robust optimisation, while minimising operational costs. Simulation results demonstrate that the probability of a network constraint violation can be as high as 70% for an electrified major UK port if the uncertainty in the port operation is neglected, presenting an unacceptable risk of disruption to port activities. Furthermore, such uncertainty can cause 150% increase in emissions if the ships use their auxiliary engine instead of using shore power. The numerical study shows that such challenges can be handled by a 0.3% increase in the robustness in face of uncertainty, while the cost increase in the worst case does not exceed 4.7%. This shows the effectiveness of the proposed method enhancing robustness against uncertainty at the minimum cost.