Here is some quick code I have put together to work with SharePoint Online tenant properties using CSOM.
The important thing to note here is that when setting the properties, we can only use the context of an App Catalog site (either tenant level or site collection level)
When getting the properties, the context of any site can be used.
Set SharePoint Online Tenant Properties in the App Catalog using CSOM:
Get SharePoint Online Tenant Properties using CSOM:
Note: While working with this code, I noticed SharePoint Online Tenant properties are stored as a web property bag entry in the root site of the App Catalog site collection. The properties are serialized to a JSON string and stored in the property bag entry with the key "storageentitiesindex":
(click to zoom)