Sadly this no longer works for Microsoft domains. Had Windows Defender mark my host file as having a 'severe' issue just because I copy pasted a list of Microsoft telemetry domains (1). Everything worked perfectly fine before that update.
(1) https://www.bleepingcomputer.com/news/microsoft/windows-10-h...