Repository navigation
Releases
Releases · Hawkode/entra-iam-automation
v1.11.0
Added
Batch/Invoke-BatchLeaver.ps1: offboards several leavers from one CSV (UserPrincipalName,Ticketon every row). Cloud-only and synced users can share a file. Every row is previewed with its leaver first, and one blocked row (break-glass, your own account, AD protected) stops the batch before anything changes. A real run needs-ExpectedCount, which must match the preview. Users are offboarded one after another, each in full (a hybrid leaver with its own sync), so a stop never leaves anyone half-offboarded; a failed row is recorded and the rest carry on. Writes a results CSV next to each leaver's own.BatchMaxLeavers(optional config key, default 10, at most 50).- Shared module:
ConvertTo-IamBatchLeaverRow, with tests.Get-IamBatchLimittakes-Key,-Defaultand-Max;Assert-IamBatchSizenames the key it checked.
Tested in the lab
- Batch leaver on the hybrid lab: a break-glass row blocked with nothing changed, preview, a wrong
-ExpectedCountchanging nothing, then a cloud-only and a synced user offboarded, each in full.
Upgrade: see docs/ADMIN-RUNBOOK.md. Batch leavers need PowerShell 7; hybrid rows also need a domain-joined machine with RSAT.
v1.10.0
Added
Batch/Invoke-BatchMove.ps1: moves many users from one CSV (UserPrincipalName,Department, optionalJobTitleandManager). Cloud-only and synced users can share a file: each row goes to the right mover. Every row is previewed first, and one blocked row stops the batch before anything changes. Hybrid rows change AD first, then one delta sync runs for the whole batch. Writes a results CSV and one review CSV for the new managers. Needs-Ticket.BatchMaxUsers(optional config key, default 50): most users one CSV may hold, for joiner CSVs and the batch move.Move-HybridUser.ps1 -SkipSyncand both movers'-NoReviewCsv, for the batch. The hybrid mover's-PassThruresult addsCloudId.- Shared module:
Get-IamBatchLimit,Assert-IamBatchSize,ConvertTo-IamBatchMoveRow,Resolve-IamUserSource, with tests.
Changed
Connect-IamGraphreuses the current session when it is the same tenant and app and already holds every scope asked for, instead of signing in and logging again. A batch then signs in once, not once per user.- Joiners with
-CsvPathstop before signing in when the file holds more thanBatchMaxUsersrows.
Tested in the lab
- Batch move on the hybrid lab: a cloud-only and a synced user in one CSV, preview, move with the OU change and one delta sync, a file with an unknown user blocked with nothing changed, then the move back.
Upgrade: see docs/ADMIN-RUNBOOK.md. Batch moves need PowerShell 7; hybrid rows also need a domain-joined machine with RSAT.
v1.9.1
Added
-RemoveAuthMethods: a log line when a method is retried after the others (Graph refuses to delete the default method while others remain), so the log shows whether the retry ran.
Tested in the lab
Get-AccessReviewExtract -AllAssignedGroups -IncludeSignIn.- Cloud leaver with a group-assigned licence.
- Hybrid leaver device item: a registered laptop is listed for a person, with OS and last sign-in.
Get-AdHygiene: a computer that never logged on.
Fixed
- Reports, joiners, movers and leavers wrote their CSV as UTF-8 without a byte order mark in PowerShell 7, so Excel showed accented names wrongly. They now use
Export-IamCsv, like the access review scripts andGet-AdHygiene. Tested: the report CSV starts with the UTF-8 byte order mark, and Excel shows accented names correctly when the console runs the report. - A report with no findings wrote a CSV holding only the byte order mark, which Excel shows as three stray characters. It now holds one row: Result, No findings. Found in the lab:
Get-AppCredentialExpiryin a tenant with no app secrets. Tested: Excel shows the No findings row. - The hybrid joiner logged a CSV path under
-WhatIfalthough no file was written. It now writes and logs the CSV only when a user was processed, like the cloud joiner.
Changed
- SECURITY.md: describes the optional own app registration (public client, no secret). README: CSV encoding,
Get-AdHygienein the folder and licence notes, current test coverage. Cheat sheet:Set-IamSignatureand the new report switches.
v1.9.0
Added
Reports/Get-AdHygiene.ps1(hybrid): AD accounts with password never expires, oldest password first, and computers with no logon for-StaleDays(defaultStaleDays) or never. Service accounts with an SPN are marked as Kerberoastable. The built-in Administrator, Entra Connect'sMSOL_account, domain controllers and the Seamless SSO account (AZUREADSSOACC) get their own finding instead of a generic action. Managed service accounts are left out of the computer list.-SearchBaselimits it to an OU,-IncludeDisabledadds disabled objects. Read-only, no Graph sign-in.Reports/Get-GroupOwnerCoverage.ps1: cloud groups with no owner (apps do not count), only disabled owners, or fewer than-MinOwners(default 2). Role-assignable groups first, member counts for flagged groups so empty ones stand out. Groups synced from AD and distribution lists are labelled, not flagged. Read-only, Entra ID Free. A group created a few minutes earlier can show a blank member count with a warning: Graph's count index lags new groups. Run it again later.Reports/Get-AppCredentialExpiry.ps1: secrets and certificates on app registrations and enterprise apps that expired or expire within-Days(default 60). A SAML signing certificate counts once, not as its Sign, Verify and password parts. Old credentials already replaced by a newer valid one are marked so you delete instead of renew. Flagged rows list the app's owners. Read-only, Entra ID Free.Reports/Get-UnusedLicences.ps1: licences on disabled accounts and on enabled accounts with no sign-in for-InactiveDays(defaultStaleDays) or never, with how each is assigned (direct or group), what to do, and a summary per licence of unused and free seats. Without Entra ID P1, or run by a role that cannot read sign-in data (User Administrator), it flags disabled accounts only and says why. Read-only.- Both leavers list the user's Entra devices under the manual follow-up items: retire or wipe a joined device (Entra or hybrid joined), remove company data from a registered one (usually personal; retire it if company-owned), with OS and last sign-in. With a OneDrive (SharePoint plan), an item to hand it over to the manager. Read-only: nothing on the device or in OneDrive changes. A failed device lookup becomes an item to check by hand, with the reason in the log.
docs/ADMIN-RUNBOOK.md: install order, adding and removing operators, upgrade with rollback, routine checks, recovering from a wrong run, troubleshooting from the lab, decommission.
Changed
- Both leavers also request
Directory.Read.All(read-only), so Graph returns the device names. Through Microsoft Graph Command Line Tools this asks for consent once more. Your own app registration already has it.
Fixed
Get-StaleAccounts: an account whose role cannot read sign-in data (User Administrator, for example) got an error and then an empty report. It now stops with the roles that can read it.Get-MgUser -Allreports a refused page as a non-terminating error, so the call now uses-ErrorAction Stop.
v1.8.0
Added
Setup/Install-IamAutomation.ps1: sets up a machine in one run. Installs the eight Microsoft Graph submodules the scripts use, all at one version, into PowerShell 7's own folders (-Scope AllUsersfor a shared jump box or when Documents is in OneDrive), optionally ExchangeOnlineManagement, unblocks the files, registers the event log source when elevated, and adds a Start menu shortcut for the IAM console (-ConsolePath). Checks each module landed, and reports the ActiveDirectory module, execution policy and config without changing them.Setup/Set-IamSignature.ps1: signs every.ps1and.psm1in a deployed copy with your code-signing certificate (SHA256, timestamped) forAllSignedor AppLocker.-Verifyreports each file's signature. Refuses a git working copy unless-Force.Connect-IamGraphstops with a clear message when the Graph modules are not installed for this PowerShell 7.
Tested in the lab
- Installer on a deployed copy, CurrentUser then AllUsers, console shortcut opening the console. Three issues found and fixed before release: modules installed for Windows PowerShell counted as present, a module in use reported as installed, a minimised shortcut.
- Signing with a self-signed certificate: 25 files signed and timestamped, all valid, a report and the console run under
AllSigned, an edited script refused as not digitally signed.
v1.7.0
Added
- Audit record in the Windows event log: every
Write-IamLogline also goes to the Application log (sourceIamAutomation; ID 1000 information, 2000 warning, 3000 error), with the Windows account and computer. A user cannot edit or delete single events, unlikeoutput\iam-automation.log. Without the source registered, scripts log to the file only and warn once per run. Linux and macOS: file only. Setup/Register-IamEventSource.ps1: registers the source once per machine (admin), or removes it with-Remove.Test-IamEventSource: whether the source is registered. It never registers it.
Tested in the lab
- Before registering: file only, one warning per run. After registering: every line as an event with the Windows account and computer, written by a normal user.
wevtutil cl Applicationas that user: Access is denied.
v1.6.2
Fixed
New-IamAppRegistration.ps1and the README said to aim a Conditional Access policy at the app. Conditional Access cannot target a public client app (error 1034,PublicClientsAreUnsupported), because it judges the resource signed in to (Microsoft Graph), not the tool. Both now say to aim the policy at the operators: their group and admin roles, all resources.
Tested in the lab
- A Conditional Access policy for the operator group (all resources, MFA, 4-hour sign-in frequency) applied to a User Administrator signing in through the own app registration, in report-only.
v1.6.1
Fixed
Get-RiskyAppPermissions.ps1ratedUser-PasswordProfile.ReadWrite.Allas Low: any permission missing from its tier list fell to Low, write scopes included. It is now Critical, with the other missing takeover paths:DelegatedPermissionGrant.ReadWrite.All,Domain.ReadWrite.All,RoleAssignmentSchedule.ReadWrite.Directory,RoleEligibilitySchedule.ReadWrite.Directory,PrivilegedAccess.ReadWrite.AzureADGroup. A write permission still missing from the list is rated Medium, never Low.Get-RiskyAppPermissions.ps1:HasCredentialreadsNot checkedon Medium and Low rows instead of being blank, which looked like "no".
Tested in the lab
- All five reports run from the IAM console through the own app registration.
v1.6.0
Added
Setup/New-IamAppRegistration.ps1: creates your own app registration for sign-in. Single tenant, public client (http://localhostand the Windows broker redirect URI), delegated Microsoft Graph scopes only, admin consent once for the organisation, Assignment required with the operators you name (-OperatorGroup,-OperatorUpn), then writesGraphClientIdtoconfig.local.psd1after a backup.-WhatIfshows the plan and creates nothing.- Config key
GraphClientId(optional). When set,Connect-IamGraphsigns in through that app instead of Microsoft Graph Command Line Tools, so operators who are not admins can sign in without consent prompts. Get-IamGraphAppScope: every delegated scope the scripts request. A test keeps it in step with theConnect-IamGraphcalls.
Changed
Connect-IamGraphlogs which app it signed in through.
Tested in the lab
New-IamAppRegistration.ps1 -OperatorGroup:-WhatIf, then a real run. A User Administrator refused with "Need admin approval" through Microsoft Graph Command Line Tools signed in through the new app with no consent prompt, and a background script signed in silently through it.
v1.5.4
Fixed
Invoke-AccessReviewDecisions.ps1: the TOTAL row of the summary showed counts as decimals (2.00). They are whole numbers now, like the reviewer rows.
Tested in the lab
Invoke-AccessReviewDecisions.ps1with a returned file in the format Excel's "CSV (Comma delimited)" writes: no quotes,TRUE/FALSE, ANSI without BOM, CRLF. Read without problems, 2 removed, 1 kept, evidence written. A file saved by Excel itself is still untested.New-HybridJoiner.ps1: CSV with two users in different department OUs (one delta sync, both licensed), and-ResumeUserPrincipalNameafter a forced timeout: no AD change, licence set, no password shown twice.Disable-CloudLeaver.ps1 -RemoveAuthMethods: Microsoft Authenticator (the default sign-in method) and a Temporary Access Pass both removed, only the password method left.