Package: nestedaaddb
nested-aad-scim-connectorThis utility provides ability to sync Users and Groups from AAD to Databricks. This application allows to syncnested groupsand users as well which is not supported in "Azure Databricks SCIM Provisioning Connector application"Using the code is as simple as below few commands :Installpip install nestedaaddbConfigureCopy the config.cfg.template from here (https://github.com/mick2004/nested-aad-scim-connector/blob/main/config.cfg.template) ,populate details and rename to config.cfgUsagefrom nestedaaddb.nested_groups import SyncNestedGroups
sn = SyncNestedGroups()
sn.loadConfig(<<Path of config.cfg>>")
sn.sync(<<Top level Group>>,<<Is Dry Run>>)DetailsSteps for running code:Step (i)Register an application in Azure ADD with ReadAll permissionsYou will need to register an application in Azure Active Directory to enable userauthenticationFollow the steps below to do same:1.Open a browser and navigate to the Azure Active Directory admin center and login using a personal account (aka: Microsoft Account) or Work or School Account.2.SelectAzure Active Directoryin the left-hand navigation, then selectApp registrationsunderManage.3.SelectNew registration. Enter a name for your application, for example, CustomAADConnector.4.SetSupported account typesas desired.5.LeaveRedirect URIempty.6.SelectRegister. On the application'sOverview page, copy the value of the** Application (client) ID** and save it, you will need it in the next step. If you chose Accounts in this organizational directory only for Supported account types, also copy the Directory (tenant) ID and save it.7.SelectAuthenticationunder Manage. Locate theAdvanced settingssection and change the **Allow public clientflowstoggle to Yes, then choose Save.In the Application menu blade, click on the Certificates & secrets, in the Client secrets section, choose New client secret:Type a key description (for instance app secret)Select a key duration as per your security concernsThe generated key value will be displayed when you click the Add button. Copy the generated value for use in the steps later.You'll need this key later in your code's configuration files. This key value will not be displayed again, and is not retrievable by any other means,   so make sure to note it from the Azure portal before navigating to any other screen or blade.9.In the Application menu blade, click on the API permissions in the left to open the page where we add access to the Apis that your application needs.Click the Add a permission button and then,Ensure that the Microsoft APIs tab is selectedIn the Commonly used Microsoft APIs section, click on Microsoft GraphIn the Application permissions section, ensure that theright permissions are checked: User.Read.AllSelect the Add permissions button at the bottom.10.At this stage, the permissions are assigned correctly but since the client app does not allow users to interact, the user's themselves cannot consent to these permissions. To get around this problem, we'd let the tenant administrator consent on behalf of all users in the tenant. Click the Grant admin consent for {tenant} button, and then select Yes when you are asked if you want to grant consent for the requested permissions for all account in the tenant. You need to be the tenant admin to be able to carry out this operation.Step (i)Populate config.cfg files with Databricks SettingsExtract the SCIM Token and ACCOUNT SCIM URL Details:https://learn.microsoft.com/en-us/azure/databricks/administration-guide/users-groups/scim/aad#step-1-configure-azure-databricksStep (iii)Running the appAs Standalon Python app:Install utility via pippip install nestedaaddbCopy the config.cfg.template ,populate details and rename to config.cfgRun as below:from nestedaaddb.nested_groups import SyncNestedGroups
sn = SyncNestedGroups()
sn.loadConfig(<<Path of config.cfg>>")
sn.sync(<<Top level Group>>,<<Is Dry Run>>)ContributorsShubham Jain💻⚠️Abhishek Pratap Singh🚇⚠️💻