We are planning to implement Local Administrator Password Solution, but the first thing I wondered was how inconvenient it would be for support engineers and helpdesk staff to retrieve LAPS account and password. Log into the Intune portal, navigate to the devices tab, search for the device, and dig through the properties to find the LAPS password — every single time they need an admin account. That had to be faster.
So (with some help of a good friend) I built the LAPS Portal: an Azure Web App with an Azure Function App as the backend, secured by two app registrations for authentication and Graph API calls. It runs at no extra cost and works on any device. Especially useful when you’re standing next to a device in the field and need the LAPS account and password right then and there — just open the portal on your phone, type the device name, and you’re done.
Resource group:rg-laps-data-portal (the RG your create before)
Name:law-laps-data-portal (name you prefer)
Region: West Europe (your desired region)
Click Review + create → Create
Once created, open Azure Cloud Shell
Choose PowerShell when asked.
Run the following script to retrieve the Workspace ID and Primary key:
$law = Get-AzOperationalInsightsWorkspace -ResourceGroupName "rg-laps-data-portal" -Name "law-laps-data-portal"; Write-Host "Workspace ID: $($law.CustomerId)"; Write-Host "Primary Key: $((Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName "rg-laps-data-portal" -Name "law-laps-data-portal").PrimarySharedKey)"
Note both output values — you will need them in Step 4 for the Function App environment variables
Note/copy the URL from Default domain on the Overview page — you need this in the next step.
Step 6: Create the App Registration for the Frontend
This app registration is required before you can enable App Service Authentication in Step 8. You need the Web App URL from Step 5 to complete this step.
Go to Entra ID → App registrations → + New registration
Name:LAPS-Portal-frontend (name your prefer)
Supported account types: Single tenant only
Click Register
Note the Application (client) ID — you will need this in Step 8
Go to Manage → Authentication(Preview) → + Add Redirect URI
Choose Web (not SPA)
Enter Redirect URI: https://<default-domein-url-from-step-5>/.auth/login/aad/callback
Check ID tokens
Click Configure.
Grant admin consent to prevent permission prompts
To ensure no users in your tenant see a permissions consent prompt when opening the portal:
Go to Permissions → click Grant admin consent for <your tenant>
Click Yes.
Remove the permission:
Step 7: Deploy the Frontend
Go to App services → Open the web app your created in step 5 → Development Tools → Advanced Tools → Go → (opens Kudu)
Open File Manager → navigate to site/wwwroot
Drag and drop index.html and proxy.php from the GitHub repo into the file manager and delete hostingstart.html.
NOTE: Do not upload the files but drag and drop them, because then an upload glitch can happenas you can see below.
Correct upload:
Wrong upload:
proxy.php acts as a server-side proxy between the browser and the Azure Function. The real Function URL and key are stored as a Web App environment variable (FUNCTION_URL) and never exposed to the browser.
Add the FUNCTION_URL environment variable to the Web App
Go to the Web App (laps-data-portal) → Settings → Environment variables → App settings → + Add:
+ 2h converts UTC to Central European Summer Time (CEST). Use + 1h in winter (CET).
It can take up to 30 min. after the first retrieve from the portal before the log query returns data.
Save the query via Save → Save as query so you don’t have to retype it. You can also pin the results to your Azure dashboard via Pin to → Azure dashboard for quick daily access.
Conclusion
With just a few Azure resources and no custom authentication code, you now have a secure, mobile-friendly LAPS portal that any authorized helpdesk engineer or IT administrator can use from anywhere — whether they’re at their desk or standing next to a device in the field.
No more navigating through the Intune portal to find a LAPS password. Just open the portal, type the device name, and you’re done.
A few things to take away from this build:
App Service Authentication secures the portal without writing any authentication code — Azure handles the entire login flow automatically.
Store secrets as Function App environment variables, never hardcoded in scripts — this keeps sensitive credentials out of your source code and version control.
Every lookup is logged with the caller’s UPN, device name, IP address, and result — giving you full accountability and a clear audit trail of who accessed what and when.
Don’t forget to configure Conditional Access with MFA and a session timeout — this adds an important extra layer of security on top of the portal authentication.
The first start/sign in to the LAPS portal can take a bit longer. When the Function App has been idle for a while, Azure deallocates the underlying infrastructure to save resources. The first request after a period of inactivity forces Azure to spin up the PowerShell runtime again, which takes 10–30 seconds.
The total Azure cost for normal internal use is effectively zero — the Function App runs on a Consumption plan and the Web App on a free F1 tier.
Automated Deployment via PowerShell Script
Instead of following all the manual steps above, you can deploy the entire LAPS Portal automatically using a single PowerShell script. The script automates every step described in this blog post and has the portal up and running in just a few minutes.
What the script does
The script automatically:
Creates the backend App Registration with the correct Graph API permissions and admin consent
Creates the Resource Group
Creates the Log Analytics Workspace
Creates the Azure Function App and deploys the function code
Creates the Web App with a unique URL
Creates the frontend App Registration with the correct redirect URI
Grants admin consent so users never see a permissions prompt
Deploys index.html and proxy.php to the Web App
Enables App Service Authentication with Microsoft as the identity provider
Restricts access to the LAPS-Portal-Admins Entra ID group
Creates a Conditional Access policy requiring MFA and a 1-hour session timeout
Requirements
An active Azure subscription with Owner permissions
One of the following Entra ID roles:
Global Administrator (easiest, covers everything), or
You will see a device code and a URL. Open the URL in your browser, enter the code and sign in with your Azure admin account. Consent to the required Graph Command Line Tool permissions.
Step 3 — Run the installation script
Once signed in to Microsoft Graph, run the installation script with this single command:
The script will run through all steps automatically and show the progress in the console. At the end you will see the portal URL.
Step 4 — Add users to the LAPS-Portal-Admins group
After the script completes, go to Entra ID → Groups → LAPS-Portal-Admins and add the helpdesk and IT support users who need access to the portal.
Step 5 — Open the portal
Browse to the URL shown at the end of the script output (first time takes some time). Sign in with your Microsoft account and you are ready to go!
Cleanup script
If you want to remove all resources created by the installation script, run the cleanup script:
Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/iamsysadmin/LAPS-portal/main/laps_cleanup_script.ps1" -UseBasicParsing).Content
Type yes to confirm,
The cleanup script removes:
The Resource Group and all Azure resources inside it (Function App, Web App, App Service Plan, Log Analytics Workspace, Storage Account)
The backend App Registration (View Laps data)
The frontend App Registration and Enterprise Application (LAPS-Portal-frontend)
The Conditional Access policy
Note: The LAPS-Portal-Admins Entra ID group is not removed by the cleanup script so your group membership is preserved.
Flowchart
So I put all the created components and their relationships into a flowchart.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.