Running the Accounts Reporting Scripts
Overview
Stephen has created a couple account reporting scripts for various client needs. These scripts will generate reports based on your inputs and email them to designated parties.
The scripts utilize built-in variables that point at specific client tenant applications using app secrets. The apps allow the scripts to utilize Graph API to gather specific information.
Current list of supported tenants:
- Accelins
- Accelins247
- Augment
- FlemingRe
- MissionUS
- MissionUK
- Sompo
Please refer to this doc for adding/removing tenants: https://soteria365.freshservice.com/a/solutions/articles/52000073141
Usage (New)
- You can now run these scripts with the help of a neat little Power Automate job.
-
The only requirement is that you've been given Run Only access to the PA job.
-
Stephen will add you to the permissions and you'll get an email notifying you that you've got access to a new Flow.
- The email/invite that you get will contain a link that looks similar to the following: https://make.powerautomate.com/environments/Default-8064a6a2-ddc4-4199-a89a-dc394433e814/flows/87b5d023-aa54-4cc0-bdb0-39c264b21611/run
- The page should load and look like the following:
- Simply go through the prompts and select which options you'd like to see.
-
Note: The "Disabled Accounts Only" toggle means "show me disabled accounts that have not logged in for over 90 days" rather than the standard "show me enabled accounts that have not logged in for 30 days"
- Once you've selected what you need, press Run Flow and it will go about running the report for you.
- When the report is generated/complete, you'll get an email in whatever inbox was invited to the flow.
Usage (Old)
- Login to Soteria's Azure portal.
- Ensure you're connected to Soteria's Directory. If not, switch to it.
- Navigate to Automation Accounts then aa-reports-accounts
- Select Runbooks and then select which report you'd like to run - we designate different reports for active/inactive for ease-of-use and coding design.
- Select Start and a box will appear with some required parameters.
-
NOTE: Both the TENANTS and RECIPIENTS parameters take String Arrays as inputs.

- This means that you can put multiple inputs for both of these and the script will handle it properly.
-
NOTE: You must follow proper syntax in order for the parameters to work. All entries must be in quotes, separated by commas, and surrounded by brackets. See examples below.
-
For Example: the TENANTS array can be any of the following:
- For just Accelins and 247:
- ["Accelins", "Accelins247"]
- For only Mission US:
- For all tenants:
-
Current list of setup tenants:
- Accelins
- Accelins247
- Augment
- FlemingRe
- MissionUS
- MissionUK
- Sompo
-
For Example for Email:you can send to any email address, or multiple addresses so long as you format it properly.
- Send to just me (Stephen):
- ["Stephen.Gemme@soteria365.com"]
- Send to Tim, Shawn, and Matt:
- ["Tim.McCratic@soteria365.com", "Shawn.Schnitker@soteria365.com", "Matt.Jones@accelins.com"]
- You also have an option for UserType which takes a single word (string) as input.

- Acceptable inputs are:
- All
- User
- Users
- Member
- Members
- Guest
- Guests
- Depending on which one you enter (only ever specify a single one of the above), the script will report on that type of user.
- Finally, you have an option for e5Only.
-
Setting this to true will make it so the report only adds people to the list who currently have an E5 license assigned to them.
-
Select Okay at the bottom, and your runbook will feed those inputs to the script and begin.
Troubleshooting
- You'll see the results of all recent jobs in the Recent Jobs/Status page.
- If your job fails to run, select it from the Recent Jobs page to view more details.
- Depending on where/how the job failed, you'll see logs in the Exceptions and/or Errors and/or All Logs tabs indicating what happened.

- ^^ For this particular example, it looks like it failed to parse one of our string array objects.
- ^^ As you can see, I did not put the proper brackets and quotes around the TENANTS parameter, causing the script to fail.