For Loop or while loop SQL consecutive dates

I have a table that tells us the date something ran and if it failed or not.
I need a query that will get the last failed date and then the last consecutive date that it failed, so basically the starting date of the failure to the end date of the failures where the dates are consecutive in between.

WITH Groups AS(
SELECT *,
ROW_NUMBER() OVER (PARTITION BY EntityID ORDER BY Date ASC) -
ROW_NUMBER() OVER (PARTITION BY EntityID, [Status] ORDER BY Date ASC) AS Grp
FROM #Sample),
TopBottom AS(
SELECT *,
ROW_NUMBER() OVER (PARTITION BY EntityID, Grp ORDER BY Date ASC) AS RNAsc,
ROW_NUMBER() OVER (PARTITION BY EntityID, Grp ORDER BY Date DESC) AS RNDesc,
DENSE_RANK() OVER (PARTITION BY EntityID ORDER BY Grp DESC) AS Ranking
FROM Groups
WHERE [Status] = 'Failed')
SELECT EntityID,
[Date],
Entities,
Loaded,
[Status]
FROM TopBottom
WHERE (RNAsc = 1 OR RNDesc = 1)
AND Ranking = 1;