r/AZURE•
prof_b

Automating Azure AD B2B logins

Hi All,

I'm currently facing a bit of a challenge and I wonder if anyone has any thoughts on how I can best approach this.

We have a partner organisation who have a SharePoint Online site that I need all our company employees to be able to access. We each have an Azure AD tenant, and I need to automate the creation of B2B guest accounts in their tenant, which can then be added to a dynamic group to gain access to the site.

I have a working Azure AD script to bulk import all our Azure AD users as guests in their tenant. However, once that's done, I'm trying to figure out the best way to deal with new starts in our environment and how I can automate adding guest accounts in the partner tenant going forward.

I'd looked at pushing our Azure AD audit logs into an event hub so I can capture the Add User event, but am struggling to see how I could use this to trigger an Azure AD script to create the corresponding guest account. I think a logic app might work here, but am not sure. Maybe there's a simpler method I'm missing?

Any suggestions would be greatly appreciated.

​

Posted Oct 4, 2018, 2:14 PM UTC

04
elementjj•

Use graph api delta query with graph to return changes and then push the B2B script against it.

2
prof_bOP•

Thanks, will take a look at that.

1
streetbr99•

Here is a good write up you might want to take a look at if you haven't already seen it.

https://blog.kloud.com.au/2017/09/19/automatically-provision-azure-ad-b2b-guest-accounts/

​

​

1
prof_bOP•

Yeah, that's the blog post I used to get the bulk import script working. My problem is how to deal with new AD accounts in our tenant and how I could potentially automate the guest account creation after the initial bulk creation is done. The problem really boils down to triggering a task when a new Azure AD user is created in our tenant.

1