If you are working on a migration project then you can get request to make old sites read only after migration so that user cannot edit or update the old sites. Sometimes you might get request from customer to make site read only mode.

PowerShell command to make site read only is:

Set-SPOSite -Identity "URL" -LockState "State"

If you have a list of site urls in CSV file then you can run a small script:

Connect-SPOService -Url "https://companyname-admin.SharePoint.com"

$SiteColl =import-csv "C:\users\username\Documents\SiteCollections.csv"

foreach($Site in $SiteColl)


  Write-Host "Set Readonly:" $Site.Url

  SetSPOSite -Identity $Site.Url -Lockstate "ReadOnly"