Microsoft Defender Live Response - The last line of defence!
Ever been in a situation when the state of the device is so bad, so unusable that it feels like you have exhausted all options and there is no hope? I think it is safe to say that most of us in the world of endpoint management, would have such days at some point in our lives.
I recently delt with a device that was in a deadlock state. To give some more context, here is a snapshot of what I was dealing with -
1. The device reset had failed from Microsoft Intune and as part of the process was also deleted from the admin portal.
2. To make matters worse, the device object was deleted from Entra ID as well. (Don't ask why, it's just the way it is.:-) ).
3. The enrolled user had standard permissions and in order to elevate the permissions, one would need either a GA role or LAPS. While LAPS was configured, due to step 2, there was no way to retrieve the password, even through Graph.
4. GA wouldn't work as well as the device had lost trust with Entra ID.
5. Even if you rebooted into terminal through advanced recovery, you needed the BitLocker recovery key to unlock the OS drive. But due to step 2, there was no way to retrieve the BitLocker recovery key, even through Graph and mysignins.
6. I was hoping to catch a glimpse of something relevant in the Entra ID audit logs, but couldn't salvage anything.
I then remembered that the device was onboarded on Defender for Endpoint and had been managed for all P2 features, including Live Response. You see MDE uses its own communication channel through the 'Sense' service that doesn't necessarily rely on Entra ID joined state and Intune management. In order to get the device back in a clean state, I decided to disjoin the device locally from Entra ID and start over. The device was showing all the tell-tale signs of a bad WinRE environment and instead of spending anymore time in repairing it, I decided to just re-install the OS.
The easiest way to run scripts through MDE remote shell is using custom PS scripts. However, you cannot run the PS commands the usual way. Live Response has its own library where the scripts have to be uploaded. You can still run some basic commands that do not involve using the custom scripts.
The easiest way to upload and manage all your scripts is by navigating to security.microsoft.com > Settings > Endpoints
To upload a script, just hit the upload option above the filters.
You can check the repository by just running the command library
I then ran the script for disjoin of the device and rebooted it manually in advanced recovery. The contents of the script is as follows -
& "C:\Windows\System32\dsregcmd.exe" /leave
The device was no longer reporting as joined to Entra ID locally. The policies were refreshed and BitLocker protection was showing as 'Off'. This gave me access to the C: in recovery and I was able to create another admin account and use that to elevate the permissions, ultimately allowing me to re-install the OS.
Tip: Since the device is rebooted into WinRE in recovery, to access the OS partition, you will need to select the correct drive letter. In case you are working with registries, you will need to mount the OS registry hive temporarily, make the changes, save it and then unload it.
There might be other ways to fix this kind of issue, but I wanted to get this device back up as quickly as possible and using Microsoft Defender Live Response seemed like a viable option. A very elegant option if you ask me. Although, considering the power of this feature, my advice will be to implement RBAC in Defender.
Until next time..




Comments
Post a Comment