Azure Active Directory - remove inactive user
This HelloID Service Automation Delegated Form can delete disabled Azure users. The following options are available:
Version | Description | Date |
---|---|---|
1.0.2 | Added version number and updated code for SA-agent and auditlogging | 2022/08/16 |
1.0.1 | Added version number and updated all-in-one script | 2021/11/08 |
1.0.0 | Initial release | 2021/09/02 |
This script uses the Microsoft Graph API and requires an App Registration with App permissions:
The interface to communicate with Microsoft Azure AD is through the Microsoft Graph API.
By using this connector you will have the ability to delete a disabled Azure AD User.
The first step to connect to Graph API and make requests, is to register a new Azure Active Directory Application. The application is used to connect to the API and to manage permissions.
Some key items regarding the application are the Application ID (which is the Client ID), the Directory ID (which is the Tenant ID) and Client Secret.
The Microsoft Graph documentation provides details on which permission are required for each permission type.
To assign your application the right permissions, navigate to Azure Portal > Azure Active Directory >App Registrations.
Select the application we created before, and select “API Permissions” or “View API Permissions”.
To assign a new permission to your application, click the “Add a permission” button.
From the “Request API Permissions” screen click “Microsoft Graph”.
For this connector the following permissions are used as Application permissions:
Some high-privilege permissions can be set to admin-restricted and require an administrators consent to be granted.
To grant admin consent to our application press the “Grant admin consent for TENANT” button.
There are multiple ways to authenticate to the Graph API with each has its own pros and cons, in this example we are using the Authorization Code grant type.
The PowerShell script “createform.ps1” contains a complete PowerShell script using the HelloID API to create the complete Form including user defined variables, tasks and data sources.
Please note that this script asumes none of the required resources do exists within HelloID. The script does not contain versioning or source control
Please follow the documentation steps on HelloID Docs in order to setup and run the All-in one Powershell Script in your own environment.
After the all-in-one PowerShell script has run and created all the required resources. The following items need to be configured according to your own environment
Variable name | Example value | Description |
AADtenantID | Azure AD Tenant Id | Id of the Azure tenant |
AADAppId | Azure AD App Id | Id of the Azure app |
AADAppSecret | Azure AD App Secret | Secreat of the Azure app |
This Delegated Form uses the following resources in order to run
If you need help, feel free to ask questions on our forum
The official HelloID documentation can be found at: https://docs.helloid.com/