[Azure] Regain admin access to your Azure AD tenant custom domain

Let me start by admitting something: I really made a mess of my Azure AD tenants over time ­čÖé If you’re career is anything like mine, you probably know how it is to have multiple Azure subscriptions, MSDN subscriptions and Azure AD tenants (which are at the root of all of your Azure activities). And since it’s spring time and all, I decided it could use a little cleaning up. And so I started moving stuff over to the subscriptions I want to use and deleting the left overs.

Somewhere in this process I might have been a little bit too enthused about throwing stuff away. And I ended up with the following situation:

  • I had an Azure AD tenant, linked to one of my custom domains.
  • The subscription linked to the tenant was deleted (or expired, not sure).
  • Within the tenant I had only one user left, which was┬áuser, not admin.

Read More

[SP2013] Getting a list of site collections using search

Getting a list of site collections from SharePoint 2013 sounds like a pretty trivial task of which you would say the client side object model is capable of handling. Well when you’re chatting with Office365 it is. And even when you’re on-premises, there’s some hacking you can do in order to utilize the same tenant-based solution. Vesa Juvonen detailed here what you need to do first (the part about setting a site collections AdministrationSiteType┬áproperty).

But what if you’re chatting against an on-prem environment, but are not allowed to make these kind of (Powershell) changes? Well in that case your only option left is to query search for the list of site collections it knows about. Be aware that this is not bullet proof! It’s depending on the search index and it will security trim any sites you do not have access to (so use an account that has access on webapplication level). Also, search is limited to giving back a maximum of 500 results per query. Fortunately, there’s some paging logic you can use to get the entire collection back in batches. If you’re interested, check out the following code snippet.

Read More