This post is a contribution from Mustaq Patel, an engineer with the SharePoint Developer Support team
Prior to CSOM ver 16.1.4727.1000, we can get count of all sites in tenant in SharePoint Online Tenant using SiteProperties.WebsCount. You can find Powershell sample at below link
With CSOM ver 16.1.4727.1000 and SPO Service dated 12/20/2016 onwards, SiteProperties.WebsCount alone as in above Powershell will not return correct value. You will see WebsCount is returned as zero. In addition, other properties returned are either zero or not up to date. You can read more on the issue in below forum.
SharePoint Online Product Group changed the implementation of how these Tenant level API works due to performance reasons. Now if we want to retrieve WebsCount and other properties of a site collection, an additional call to Tenant.GetSitePropertiesByUrl is needed and the Property collection acquired from that call needs to be used to get WebsCount and other properties. Below is the working sample.
Assemblies to Reference
The above two assemblies can be found at C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI
This assembly can be found at C:\Program Files\SharePoint Client Components\16.0\Assemblies)
Below is the code to get the webs count property.
You can also read the above resolution on below blog
One more recommendation from the product group is to use Tenant.GetSitePropertiesFromSharePointByFilters instead of Tenant.GetSiteProperties as it is a performance-intensive call and may be deprecated in future. As of now, though GetSitePropertiesFromSharePointByFilters does not work for some site templates and is not fully ready yet. I will update this blog with new sample that uses GetSitePropertiesFromSharePointByFilters, once service side of things are fixed and tested.