SharePoint Online: Create a list using PowerShell

Here is a sample PowerShell code which creates a list (Document Library) in SharePoint online.
Before running this code make sure SharePoint Online Client Components SDK and SharePoint Online Management Shell is installed on your machine. 
#Import the required DLL
Import-Module 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll'
#OR
#Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll'

#Mysite URL
$site = 'https://yoursite.sharepoint.com/'

#Admin User Principal Name
$admin = 'admin@tenant.onmicrosoft.com'

#Get Password as secure String
#$password = Read-Host 'Enter Password' -AsSecureString
$password = ConvertTo-SecureString "YourPassword" -asplaintext -force
#Get the Client Context and Bind the Site Collection
$context = New-Object Microsoft.SharePoint.Client.ClientContext($site)

#Authenticate
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($admin , $password)
$context.Credentials = $credentials
$listCreationInformation = New-Object Microsoft.SharePoint.Client.ListCreationInformation
$listCreationInformation.Title = "My Documents"
$listCreationInformation.Description = "Library created through PowerShell"
$listCreationInformation.TemplateType = 101
$list = $context.Web.Lists.Add($listCreationInformation)
$context.Load($list)
$context.ExecuteQuery()
If you want to prompt the user for password use $password = Read-Host 'Enter Password' -AsSecureString instead of $password = ConvertTo-SecureString "YourPassword" -asplaintext -force.

Library