When using ADS-B are squawk codes still necessary or does the unit provide a discrete code (like a tail number or something) that is recognized by ATC?
Yes, squawk codes are still used and required with ADS-B.
It's possible that in the future this may change, but because of the bifurcated implementation the FAA has chosen for ADS-B I don't think it's likely.
ADS-B operates by giving additional information beyond the Mode A (squawk) code - this is either encoded on the 1090MHz transponder frequency (Mode S "Extended Squitter" - what most of the world uses) or sent on a separate frequency (the 987MHz "Universal Access Transceiver" frequency, which is a US/FAA only thing mainly intended for light GA aircraft).
The Mode S and Extended Squitter data includes things like the aircraft's unique Mode S address (a 24-bit number assigned to the aircraft by its national registry, in the US this is linked to the N number), and may also provide the tail number or flight number. The ATC radar system will accept and display this information for the controller.
At the moment the Mode S/ES data is not used as a substitute for the Mode A transponder code, but because Mode S data is coming through the ATC secondary radar system it's all immediately available with the secondary radar return the same way a Mode A squawk code is, and it's possible that the FAA may use the Mode S ID in place of the Mode A squawk code for these aircraft in the future.
The 987MHz UAT transmissions also include the Mode S address (because it's a useful unique identifier for a given aircraft) and flight ID/tail number can be sent as well. Information from UAT transmitters is received through separate ground stations and recombined with the radar return in the ATC radar back-end.
There's some magic to that recombining which is out of my depth, but my limited understanding is that since the UAT data isn't directly correlated with a radar return squawk codes are part of how the two are matched up (the radar computer knows your N number by your discrete squawk code, the UAT ground station knows it from your Mode S ID - if they match and the position data is within reason the ADS-B information can be associated with your radar data block).