Proceeding pursuant to CPLR article 78 (transferred to the Appellate Division of the Supreme Court in the Fourth Judicial Department by order and judgment of the Supreme Court, Oneida County [Bernadette T. Clark, J.], entered February 7, 2013) to review a determination finding after a tier II hearing that petitioner had violated an inmate rule.
EDDIE ORTIZ, PETITIONER PRO SE.
ERIC T. SCHNEIDERMAN, ATTORNEY GENERAL, ALBANY (MARCUS J. MASTRACCO OF COUNSEL), FOR RESPONDENTS.
PRESENT: SMITH, J.P., CENTRA, FAHEY, CARNI, AND WHALEN, JJ.
It is hereby ORDERED that said appeal insofar as it concerns the declaratory judgment action is unanimously dismissed, the determination is confirmed without costs and the petition is dismissed.
Memorandum: Petitioner commenced this hybrid CPLR article 78 proceeding and declaratory judgment action, seeking to challenge the determination, following a tier II disciplinary hearing, that he violated inmate rule 106.10 (see 7 NYCRR 270.2 [B]  [i] [refusal to obey orders]). Supreme Court sua sponte dismissed the declaratory judgment causes of action in the complaint and transferred the CPLR article 78 proceeding to this Court pursuant to CPLR 7804 (g), to review a question of substantial evidence.
We note at the outset that the appeal must be dismissed insofar as it concerns the court's sua sponte dismissal of the declaratory judgment causes of action (see Mohler v Nardone, 53 A.D.3d 600, 600). No appeal lies as of right "from an ex parte order, including an order entered sua sponte" (Sholes v Meagher, 100 N.Y.2d 333, 335; see Obot v Medaille Coll., 82 A.D.3d 1629, 1630, appeal dismissed 17 N.Y.3d 756), and permission to appeal has not been granted (see CPLR 5701 [c]).
Contrary to petitioner's contention with respect to the CPLR article 78 proceeding, the determination is supported by substantial evidence. We reject petitioner's contention that the Hearing Officer erred in refusing to permit him to present evidence concerning his allegedly valid excuse for failing to obey the correction officer's order. The reason for the order is "irrelevant to the issue of his guilt or innocence" (Matter of Washington v Napoli, 73 A.D.3d 1300, 1300). Indeed, " [t]he risks inescapably attendant on the refusal of an inmate to carry out even an illegal order of a correction officer are such as to require compliance at the time' " the order is given (Matter of Roman v Coughlin, 202 A.D.2d 1000, 1001, quoting Matter of Rivera v Smith, 63 N.Y.2d 501, 515; see Matter of Hogan v Fischer, 90 A.D.3d 1544, 1545, lv denied 19 N.Y.3d 801).
We have considered petitioner's remaining contentions with respect to the CPLR article 78 proceeding, and we ...