[Samsung Galaxy A21s Guides, News, & Discussion] kcchan48:
Tested this on my Samsung A21s following OP steps. Works without issues. Summary of steps I did (in order):

Download the Samsung Firmware Downloader.exe (v0.5.2) Zachary Wander based on Samloader

GitHub - zacharee/SamloaderKotlin

Contribute to zacharee/SamloaderKotlin development by creating an account on GitHub.

github.com

I downloaded the ready-to-run exe Windows version.

Note: When launching on Windows 10 PC, received a pop-up error 'The os does not support: 'Taskbar.setIconImage' . I ignored this error.

In this app,

for Model: SM-A217F (retrieved from Settings > About phone > Model number

for Region: XSA (retrieved from Settings > About phone > Software information >Service provider software version

Click the "Check for Updates" button, it will provide you with the latest Firmware version eg.

A217FXXS7CUI3/A217FOLM7CUI3/A217FXXS7CUI3/A217FXXS7CUI3

Click the "Download" button to download the firmware to your PC

This will download an encrypted version of the firmware to your PC and automatically decrypt it to a zip file eg.

SM-A217F_1_20210915175645_mbisbo1d5k_fac_A217FXXS7CUI3_A217FOLM7CUI3_A217FXXS7CUI3_A217FXXS7CUI3_XSA.zip

Next download the modified verson of Magisk for the A21s at the start of this thread eg.

Magisk_patched_for_A21S.apk

Magisk is used to patch the firmware to enable root. This will void your warranty and you will have to put up with warnings every time to power off/on your phone eg.

"The phone is not running Samsung's official software...."

Installing Magisk will cause a full data wipe of your phone. So make sure you do a full backup of your phone using Samsung Smart Switch app running on your PC. In addition, I also use File Transfer to copy important folders/files on my phone directly to my PC hard disk. Note: not all applications will have their data restored successfully so you need to make sure you can reinstall and configure those applications eg. Google Authenticator

The next software you need to download is Odin which runs on Winodws. Search online for it. I downloaded and used this version:

Odin3_v3.14.1.zip

Odin is used to load the custom firmware back onto the phone.

At this stage, you have not made any changes to your phone. But you have now got all the software needed in place to root your phone. Once you proceed with the next step, your phone will no longer be running the official Samsung software and you will be reminded of this every time you power on/off your phone. Also, you may not be able to update the Samsung software using the Software Update option.

Read through the steps in the section "Samsung (System-as-root)" on how to install Magisk to your phone

Installation

The Magic Mask for Android

topjohnwu.github.io

DO NOT PROCEED WITH THE "Unlocking Bootloader" step IF ARE NOT COMFORTABLE WITH THE INSTRUCTIONS THERE.

Tip: While it is stated in the instructions, the following step may not be clear:

Reboot to download mode. Open Odin on your PC, and flash magisk_patched.tar as AP, together with BL, CP, and CSC (NOT HOME_CSC because we want to wipe data) from the original firmware.

You need to unzip the BL, CP and CSC files from the downloaded firmware zip file as well to use in this step.

I decided to root my phone just to get the Axet Call Recorder function to work correctly under Magisk. Which it did after I installed Magisk but the Wifi Calling had to be turned off.