Entra ID Tenant Information API - SharePoint Support đ
We've added another two properties to the Entra ID Tenant Information API response, this time targeting SharePoint!
Once again, we're making changes to the Entra ID Tenant Information API. This time to include information surrounding SharePoint Online.
To refresh your memory on this API, or introduce yourself to it for the first time, refer to this post - Entra ID Tenant Information API.
We're now including two additional properties in the Tenant Information API response object.
- tenantUsesSpo
- spoDomains
Again, these properties should be self-explanatory, however, if not, let's go through what they mean together.
tenantUsesSpo
This property indicates whether the tenant uses the SharePoint Online service. It's determined by whether the the "spoDomains" array has any values.
So, it's either going to be "True" or "False".
spoDomains
This property returns an array of SharePoint Online domains associated with the tenant. We've had to perform a little bit of trickery to get these values, let me explain...
There's no publicly available API or service available to retrieve the SharePoint domains that are associated with a Microsoft tenant, therefore, we've had to perform a "best-guess" analysis on the "additionalDomains" within the tenant.
Here's how we do it:
- We first retrieve all the "additionalDomains" associated with the tenant. Now, we know each Microsoft tenant must have at least one ".onmicrosoft.com" domain, and we also know this domain is used to derive the SharePoint Online tenant domain.
- You can't have a SharePoint Online domain, without a corresponding "onmicrosoft.com" domain.
- We then filter the "additionalDomains" array, returning only the values that contain ".onmicrosoft.com".
- We ignore all custom domains. We're not interested in those.
- We then loop through all those ".onmicrosoft.com" domains, and do a string replace, replacing ".onmicrosoft.com" with ".sharepoint.com".
- When then perform a DNS A lookup on the ".sharepoint.com" domain. If a record is returned, we safely assume the SharePoint domain is live, active, and reachable.
- The SharePoint domain is then added to the "spoDomains" array.
You might be thinking... but surely only one domain would be returned for SharePoint. Well, that was my initial thought when I first started designing the process for these properties, until it dawned on me...
SharePoint Online supports multi-geo capabilities.
Meaning, a Microsoft tenant can have SharePoint sites located in varying different Microsoft datacenter locations across the globe. Therefore, a tenant may have more than one SharePoint domain, depending on whether that tenant has multi-geo enabled, and SharePoint provisioned in those locations.
And there we have it! Your two additional properties, aimed at retrieving SharePoint Online specific information. Fingers crossed they provide you some additional use.