The easiest way is to create a .csv file that can be imported into Canvas, using the Admin SIS Import tool.
Create a .csv that contains the Course ID, the User ID, and the role:
"Course_ID","User_ID","Role","Status"
"45593","160131","Teacher","active"
The first line is the header of the csv file.
The 2nd line contains the Course ID (45593), the User ID (160131), the Role (Teacher), and the status to make this entry (active).
Go to your Admin page, click SIS Import, select Choose File and browse to your .csv file. Click Process Data.
Eventually, you'll do this enough times to want to create a batch file that creates the .csv file for you:
@Echo off
REM add-a-person-to-a-course.bat [SIS_userid] [course ID] [Role]
REM next line needed so we can use the variable within the for loop, otherwise, it is only sent once when the Batch file was started
SETLOCAL ENABLEDELAYEDEXPANSION
rem create a starting userid variable file with -1 in it
echo -1 >userid.var
if "%3%" == "" goto ErrEnd
cls
echo ==========================
echo ADD A PERSON TO A COURSE
echo ==========================
echo.
echo This script will build a .csv file that can be manually
echo uploaded into Canvas, to ADD a person to a course.
echo EXAMPLE: to add user 314204 to course 45004, as a TA:
echo add-a-person-to-a-course.bat 314204 45004 TA
echo.
echo %1 is the SIS User ID
echo %2 is the Course ID
echo %3 is the Role
REM We now have all the values we need -- the user id, the course, and the Role
REM Build the enroll-courseID.csv file here...
echo "Course_ID","User_ID","Role","Status"> enroll-%2.csv
echo "%2","%1","%3","active">> enroll-%2.csv
Echo.
Echo Please upload enroll-%2.csv to Canvas using the Admin SIS Import page.
Echo.
type enroll-%2.csv
goto End
:ErrEnd
Echo.
Echo Syntax Error: add-a-person-to-a-course [SIS user id] [Course ID] [Role]
Echo Example: add-a-person-to-a-course.bat 304482 45004 TA
Echo.
goto end
:End