I have a ZD28F and I agree with Stubbyie, it's most likely a safety switch, be sure to check the parking brake switch and make sure the brake is off and the linkage is working correctly. If it cranks and runs with the control arms out and only dies when the are moved together, then it seems that either the brake is not releasing all the way or the sensor is out of position or bad. You can jump the sensor to check if this is the problem but please replace or correctly position the switch and not run with the switch jumped.
I can't tell you how many times I have started mine and forgot the brake was on and had the engine die a few seconds later after I move the control arms to the center to start moving or engaged the pto and had the same same happen when the brake was not released... I hope this helps...
Joe