Summary
My customer had a requirement to get the list of Site Collection Admins (SCAs) for any site within the tenant for anyone in the organization. The need of the user is to find additional information from the SCA.
This request can be on-demand from any user within the organization. The resolution is to have a tool for a user to request a site URL. Using the user’s Site URL request the tool can find out the SCAs for the site. The tool will fill out the Multi People field for the same request.
This tool as “Find SCAs Tool”
Prerequisite
- “FindSCARequestTracker” SharePoint List
- Azure Logic
- Azure Function
- PnP.PowerShell
Step By Step Solution
Step # 1 : Create a “FindSCARequestTacker” SharePoint List
Internal Name | Display Name | Column Type |
Title | Site URL | Single line of text |
ListOfSCA | List Of SCAs | Multi People field |
Status | Status | Read Only – Choice field with New & Completed |
The Status field default value is “New”.
Step # 2: “ProcessFindSCARequestTracker” Logic App
The logic app will trigger on items created or modified for the above SharePoint list. The trigger condition for this is to check only trigger the flow when the Status field is New.
@contains(triggerBody()?['Status']?['Value'],'New')
There are only two actions in the flow. The first action is to make a call to an HTTP Trigger Azure Function. The second call is to Update the SharePoint item. The update is updating the “Status” field as Completed and the “ListOfSCA” field with the results from the Aure Function.
Step # 3: “find-sca-by-site” Azure Function.
The “find-sca-by-site” Azure Function is set as an HTTPTriggered function. The input to the to the call is the JSON value with the Site URL. The output of this function is also JSON with the Claims array with the email address of the SCAs.
NOTE: You can refer to my previous post to set up Azure Function and Certificate. How to set up certificate in MAG Azure Function App for PnP.PowerShell?
NOTE: To get to the code for the above Azure function, please click here.
Please make sure the Azure AD app you create has the following permissions.
Results

Conclusion
With help of the Azure resource to get the list of Site Collections Admins can be created as a Tool. This will help reduce SPO admins’ tasks and the tools can provide information on what a user needs.