Cefazolin is typically administered intravenously or intramuscularly. The dosage and duration depend on the type and severity of the infection, as well as the patient's renal function. For surgical prophylaxis, a single dose is usually given within 60 minutes before the incision.