Any sacrament that is administered by a priest or bishop is administered validly but illicitly if all other requirements for validity are satisfied but the priest or bishop is excommunicated:
An excommunicated person is forbidden ... to celebrate the sacraments or sacramentals and to receive the sacraments.
(Code of Canon Law, Canon 1331 section 1)
That covers all the sacraments except marriage, which the priest does not administer.
Suppose however that the minister of the sacrament is not excommunicated. Then the following seems to obtain:
In the case where the priest or bishop is not excommunicated, baptism can be administered validly but illicitly if the infant is not in danger of death, and the one baptizing has not obtained the consent of at least one parent:
Canon 868 section 1: For an infant to be baptized licitly:
Note 1. the parents or at least one of them or the person who legitimately takes their place must consent;
Canon 868 section 2: An infant of Catholic parents or even of non-Catholic parents is baptized licitly in danger of death even against the will of the parents.
Confirmation can also be thus administered if the confirming bishop is doing the confirmation in another diocese, to residents of that diocese, without it being reasonable to assume that the bishop of that diocese has given permission:
To administer confirmation licitly in another diocese, a bishop needs at least the reasonably presumed permission of the diocesan bishop unless it concerns his own subjects.
(Canon 886 section 2)
Confession/Penance/Reconciliation appears to be performed either validly and licitly, or else invalidly and illicitly. It appears that it cannot be valid but illicit.
The sacrament requires permission (a "faculty") from the bishop of the diocese to perform; but a priest without this faculty administers confession not only illicitly but invalidly.
The valid absolution of sins requires that the minister have, in addition to the power of orders, the faculty of exercising it for the faithful to whom he imparts absolution.
(Canon 966 section 1)
Ordination is also illicit if a Latin rite bishop ordains a man of an Eastern rite church without permission from the Holy See:
If not impeded by a just cause, the proper bishop is to ordain his own subjects personally; without an apostolic indult, however, he cannot ordain licitly a subject of an Eastern rite.
(Canon 1015 section 2)
It appears that marriage can be valid but illicit if the parties are wedded above the age required by canon law (16 for men, 14 for women) but below the age required by the local episcopal conference:
A man before he has completed his sixteenth year of age and a woman before she has completed her fourteenth year of age cannot enter into a valid marriage.
(Canon 1083 section 1)
The conference of bishops is free to establish a higher age for the licit celebration of marriage.
(Canon 1083 section 2; emphasis added)
It appears that a priest who is not under some form of canonical penalty (such as excommunication) celebrates the Eucharist both validly and licitly. Canon law gives a list of canonical provisions to be observed. For example, the priest cannot celebrate the Eucharist all by himself, nor more than once a day without permission of the bishop. But the law does not specify that failing to observe these makes the celebration illicit.
A priest not impeded by canon law celebrates the Eucharist licitly; the provisions of the following canons are to be observed. ...
(Canon 900 section 2)
Anointing of the Sick
I cannot find anything in the Code that specifies circumstances under which the Anointing is celebrated illicitly.
Thus it appears that under ordinary circumstances, baptism, confirmation, orders, and marriage may be celebrated validly but illicitly; and if a priest is excommunicated, any of the sacraments may be thus celebrated.