When creating modern site collections (e.g. sites with STS#3 Base Template) in SharePoint Online using CSOM the creator of the site will be automatically set as site owner and afterwards becomes site collection administrator afterwards.
To prevent this you have to change to primary site admin, remove old admin user from the site collection admins. This can be done in CSOM using the following logic.
Weiterlesen „CSOM: Set primary set collection admin“