Edit your /etc/hosts on RPI (or add that domain to your Pi-Hole) sudo nano /etc/hosts
Add the following line: 0.0.0.0 packages.microsoft.com
Save and close the file in vim. Put Debian package on hold so that it will not install further updates: sudo apt-mark hold raspberrypi-sys-mods
Delete Microsoft’s GPG key using the rm command: sudo rm -vf /etc/apt/trusted.gpg.d/microsoft.gpg
Make sure new keys cannot be installed: sudo touch /etc/apt/trusted.gpg.d/microsoft.gpg
Next, write protect that file on Linux using the chattr command: sudo chattr +i /etc/apt/trusted.gpg.d/microsoft.gpg lsattr /etc/apt/trusted.gpg.d/microsoft.gpg
(post is archived)