[Scripts] Veeam Backup for Microsoft 365 - Audit Email/Audit Users


Userlevel 7
Badge +6

Hello, a few years ago I wrote a few articles about this very interesting, and common topic:

They were very well received in my opinion, with tons of comments, and lots of views.

 

But since then, many changes have happened, first to the Veeam Backup for Microsoft 365 APIs, secondly Microsoft disabling SMTP and making our life difficult with OAuth for simple stuff like this.

Good news are:

  1. The first blog post have been updated with the OAuth steps, so if you are struggling with that, please take a look now :)
  2. I wrote two very simple PowerShell Scripts to make your life easy.

Automating the painful Microsoft/Google Oauth for VB365 Audit Mail Settings

If you want to automate this process, because do this manually is the biggest pain I had in this 2023 by far. You will find the script here:

Very simple to modify and run. You will need the Client/Client Secret/Tenant ID, but probably you have done this many times in AzureAD anyways.

Example of what to expect:

Should be painless enough for those using OAuth.

Automating the process to add Users to the Audit list

Now, to the process of adding more Users to the Audit, so any operation will trigger an email, there is an script to do this by Steve, but seems outdated. So I’ve created a more visual way of doing this:

It will look like this, very painless, just introduce your VB365 IP/hostname, with your credentials on the script, run it and enjoy:

PS: The script does not have yet Teams, SharePoint, etc. And I have not tested it with thousands and thousands of users, but if you do, share feedback :)

Hope it helps guys


7 comments

Userlevel 7
Badge +20

Great to see you updated these scripts Jorge.  👍

They were very interesting the first time I read through them.

Userlevel 7
Badge +17

Very cool Jorge. Thanks for the share & update! 

Userlevel 7
Badge +5

Thank you @jorge.delacruz for sharing !

Userlevel 7
Badge +8

Very handy script.. I’ll add it to my list for when we migrate. Thanks!

Userlevel 5
Badge +3

Can I ask if anyone has managed to get the Group auditing working?

Userlevel 7
Badge +6

Hello,

The groups part has now been added to the script:

You can still find it where it always was, VeeamHub:

Amazing work on the script Jorge, it's awesome!

For larger organizations, its possible that running the script won't discover the full amount of the users/groups as the returned results is limited to 30 by default,  

One quick fix could be to allow the maximum amount of items to be returned by increasing the limit -

Users:
$entities = Invoke-RestMethod -Method Get -Uri "$baseUrl/Organizations/$($selectedOrgId)/Users?limit=10000" -Headers $headers

Groups:
$entities = Invoke-RestMethod -Method Get -Uri "$baseUrl/Organizations/$($selectedOrgId)/Groups?limit=10000" -Headers $headers

Obviously with a large amount of users it will be difficult to find specific ones as the returned list will be unordered, but throwing in a “sort” somewhere might make that a bit easier!

Comment