New Employee Record Creator
When a new user is created in Azure AD, automatically insert an onboarding record into a SQL tracking table. Demonstrates Insert Row triggered by identity events.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
FlowLibs - New Employee Record Creator automates employee onboarding by looking up a new user's profile in Microsoft Entra ID (Azure AD) and inserting an onboarding record into a SQL Server tracking table. An HR notification email is sent with the new employee's details, ensuring the onboarding process begins immediately.
Use Case
When a new employee joins the organization and their account is created in Azure AD, this flow:
1. Retrieves the employee's profile (display name, email, department, job title) from Entra ID 2. Creates an onboarding record in a SQL Server tracking table 3. Sends an HTML-formatted notification email to HR with all relevant details
This demonstrates how identity events in Azure AD can drive downstream database operations and notifications — a common pattern for employee lifecycle automation.
The flow is ideal for teams that:
- HR teams automating new-hire onboarding from identity events
- IT admins integrating Azure AD with downstream tracking systems
- Organizations standardizing employee lifecycle workflows
- Teams that want SQL-backed audit records of onboarding activity
Flow Architecture
Manually trigger a flow
ButtonAccepts a User Principal Name (UPN) as input.
Init varSqlServerName
Initialize VariableLoads SQL server name from environment variable.
Init varSqlDatabaseName
Initialize VariableLoads SQL database name from environment variable.
Init varHrEmail
Initialize VariableLoads HR notification email from environment variable. Steps 1-3 run in parallel for efficiency.
Get User Profile
OpenApiConnection (Entra ID)Calls GetUser to retrieve full profile by UPN.
Insert Onboarding Record
OpenApiConnection (SQL Server)Calls PostItem_V2 to insert a row with DisplayName, Email, Department, CreatedDate, and OnboardingStatus.
Send HR Notification
OpenApiConnection (Outlook)Sends a styled HTML email with an employee details table to the HR notification address.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SqlServerName | String | <configure> | Target SQL Server hostname (e.g. yourserver.database.windows.net). |
| flowlibs_SqlDatabaseName | String | <configure> | Target SQL database name where the onboarding tracking table lives. |
| flowlibs_NotificationEmailAddress | String | you@yourcompany.com | HR team email address that receives the new-employee notifications. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Microsoft Entra ID | shared_azuread | GetUser (retrieve employee profile) |
| SQL Server | shared_sql | PostItem_V2 (insert onboarding row) |
| Office 365 Outlook | shared_office365 | SendEmailV2 (HR notification) |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Update environment variables
- Set flowlibs_SqlServerName and flowlibs_SqlDatabaseName to your SQL Server instance, and flowlibs_NotificationEmailAddress to the HR distribution alias.
- Create the Onboarding tracking table
- In your SQL database, create the target table with columns: DisplayName (nvarchar), Email (nvarchar), Department (nvarchar), CreatedDate (datetime), OnboardingStatus (nvarchar).
- Authorize connections
- Open the flow in the designer and authorize the Entra ID, SQL Server, and Office 365 Outlook connections in your target environment.
- Convert to an automated trigger
- The shipped flow uses a manual trigger for easy testing. To automate it, replace the trigger with a Recurrence (hourly/daily), add an HTTP action that queries Microsoft Graph for users created since the last run (GET https://graph.microsoft.com/v1.0/users?$filter=createdDateTime ge {cutoffDate}), and wrap the Get User / Insert / Send Email actions in an Apply to each. The Entra ID connector has no built-in trigger for user-creation events.
- Expand the onboarding record
- Add columns such as JobTitle, ManagerUpn, or OfficeLocation in the SQL table and map them from the Get User Profile outputs to capture richer onboarding data.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Read manual trigger input
Extracts the UPN entered when the flow is manually run.
EXPR.02Display name from Entra ID
Pulls the employee's display name for the SQL row and email body.
EXPR.03Email address from Entra ID
Pulls the employee's primary email address.
EXPR.04Department from Entra ID
Pulls the employee's department for the onboarding record.
EXPR.05Job title from Entra ID
Used in the HR notification email for additional context.
EXPR.06Timestamp the onboarding record
Sets CreatedDate on the inserted SQL row.
EXPR.07Read environment variable
Loads the SQL Server hostname env var into a flow variable at runtime.
EXPR.08Reference initialized variable
Used as the To address on the HR notification email.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.