Non permanent Entry Cross (TAP) is a Microsoft Entra ID (Azure AD) characteristic that permits directors to create time-limited passcodes for consumer authentication. These codes are notably helpful in eventualities like onboarding, recovering entry, or transitioning to passwordless authentication.
Utilizing the Microsoft Graph PowerShell module, you may effectively handle TAP codes programmatically. Right here’s how one can create and delete TAP codes with ease.
My assumption is that you’ve got already registered the APP in Entra with API permissions (UserAuthenticationMethod.ReadWrite.All) and connected certificates to it for connection.
Refer: Create temporaryAccessPassMethod
Step first is to connect with Microsoft graph module
Join-MgGraph -ClientId $ClientID -CertificateThumbprint $ThumbPrint -TenantId $TenantName
- Exchange
$ClientID
along with your App Registration ID.
- Exchange
$ThumbPrint
along with your certificates’s thumbprint.
- Exchange
$TenantName
along with your Entra tenant ID.
Now let’s create a TAP code for one of many accounts
$userId = “TESTUSER1@labtest.com”
[string]$CurrentDateTime = (Get-Date).ToUniversalTime().ToString(“yyyy-MM-ddTHH:mm:ss.fffZ”)
$physique = @{
“startDateTime”= “$CurrentDateTime”
“lifetimeInMinutes”= 14400
“isUsableOnce” = “$false”
}
$tapcode = New-MgUserAuthenticationTemporaryAccessPassMethod -UserId $userId -BodyParameter $physique
$tapcode.TemporaryAccessPass # this offers you the generated passcode

Equally, there will be state of affairs the place you need to delete the passcode because it has already been used, and also you need to expire it earlier than its expiry.
$checktapforuser = Get-MgUserAuthenticationTemporaryAccessPassMethod -UserId $userId
Take away-MgUserAuthenticationTemporaryAccessPassMethod -UserId $userId -TemporaryAccessPassAuthenticationMethodId $checktapforuser.id

Managing TAP codes with the Microsoft Graph PowerShell module permits directors to automate safe entry administration. Through the use of certificate-based authentication, you guarantee a safe and scalable option to deal with TAPs programmatically.
Thanks for studying…
Tech Wizard