Medicare is primary, you need to be enrolled in both Medicare Part A and Part B. Federal Medicare regulations say that once a person age 65 or older ceases current employment, any other type of insurance, including COBRA, kicks in only after Medicare pays its share. If there’s no Medicare coverage, the insurer is under no obligation to pay Medicare’s portion.
But there are situations where your COBRA plan would be primary.
If you are on Medicare as a result of ESRD (end stage renal disease) the role is reversed and COBRA is primary, Medicare secondary.
You can review the Medicare publication "Who Pays First" for more detail.