<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Intune &#8211; Cyberillo</title>
	<atom:link href="https://cyberillo.com/category/microsoft/intune/feed/" rel="self" type="application/rss+xml" />
	<link>https://cyberillo.com</link>
	<description>Reliable Tech Tips and Services</description>
	<lastBuildDate>Mon, 29 Dec 2025 08:23:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://cyberillo.com/wp-content/uploads/cropped-favicon-100x100.png</url>
	<title>Intune &#8211; Cyberillo</title>
	<link>https://cyberillo.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Local Admin Report with Intune and Log Analytics</title>
		<link>https://cyberillo.com/local-admin-report/</link>
					<comments>https://cyberillo.com/local-admin-report/#respond</comments>
		
		<dc:creator><![CDATA[Sylvan Abela]]></dc:creator>
		<pubDate>Mon, 29 Dec 2025 08:16:15 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Intune]]></category>
		<guid isPermaLink="false">https://cyberillo.com/?p=3613</guid>

					<description><![CDATA[<p>Learn how to create a report of local administrator accounts across your domain with Intune and Log Analytics.</p>
<p>The post <a rel="nofollow" href="https://cyberillo.com/local-admin-report/">Local Admin Report with Intune and Log Analytics</a> appeared first on <a rel="nofollow" href="https://cyberillo.com">Cyberillo</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In a busy IT environment, handing out &#8220;temporary&#8221; local admin access is almost second nature. A user needs to install something, you grant the access, fix the problem, move on to the next ticket… and forget all about it.</p>



<p>The problem? Those leftover admin rights don’t go away on their own. Over time, they quietly pile up and turn into a serious security risk, which most monitoring tools never bother to check. If you don’t know who’s in the local Administrators group, you’re basically trusting luck.</p>



<p>In this guide, I&#8217;ll walk you trough how to use Intune and Log Analytics to get a clear, reliable report of who actually has local admin access on every device in your environment.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>





<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Solution Overview</h2>



<p>We use a proactive approach to ensure no local admins stay hidden:</p>



<ol class="wp-block-list">
<li><strong>Detection:</strong>&nbsp;A PowerShell script runs daily on every machine to query the administrators group.</li>



<li><strong>Ingestion:</strong>&nbsp;Data is sent to a custom table in our Log Analytics Workspace.</li>



<li><strong>Analysis:</strong>&nbsp;KQL queries filter out authorized local administrator accounts to highlight outliers.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">1. The PowerShell Collection Script</h2>



<p>This script gathers members of the local admin group and sends the data to Azure. By running this via Intune, we get a fresh snapshot of the local admins on each PC every  24 hours.</p>



<p><strong>Prerequisite 1</strong>: Get the <code>$CustomerID</code> from the log analytics workspace Overview tab.</p>



<figure class="wp-block-kadence-image kb-image3613_2d7d33-b1 size-large border"><img fetchpriority="high" decoding="async" width="1024" height="264" src="https://cyberillo.com/wp-content/uploads/Get-Workspace-ID-From-Overview-Section-In-Log-Analytics-1024x264.png" alt="Get-Workspace-ID-From-Overview-Section-In-Log-Analytics" class="kb-img wp-image-3628" srcset="https://cyberillo.com/wp-content/uploads/Get-Workspace-ID-From-Overview-Section-In-Log-Analytics-1024x264.png 1024w, https://cyberillo.com/wp-content/uploads/Get-Workspace-ID-From-Overview-Section-In-Log-Analytics-300x77.png 300w, https://cyberillo.com/wp-content/uploads/Get-Workspace-ID-From-Overview-Section-In-Log-Analytics-768x198.png 768w, https://cyberillo.com/wp-content/uploads/Get-Workspace-ID-From-Overview-Section-In-Log-Analytics-1536x397.png 1536w, https://cyberillo.com/wp-content/uploads/Get-Workspace-ID-From-Overview-Section-In-Log-Analytics.png 1681w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p><strong>Prerequisite 2:</strong> To get the <code>$SharedKey</code>, use this AZ CLI query.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">az monitor log-analytics workspace get-shared-keys \
   --resource-group xxxxx \
   --workspace-name xxxxxx \
   --query "primarySharedKey"</pre>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># --------------------------------------------------------------------------
# PowerShell Script: Send Local Administrator Group Members to Log Analytics
# --------------------------------------------------------------------------

# ======================
# 1. Configuration
# ======================
$CustomerID = "&lt;your-customer-id>"
$SharedKey  = "&lt;your-shared-key>"
$LogType    = "LocalAdminReport"

# ======================
# 2. Data Collection
# ======================
$DeviceName = $env:COMPUTERNAME

try {
    $AdminMembers = Get-LocalGroupMember -Group "Administrators"
} catch {
    Write-Error "Error retrieving local group members: $($_.Exception.Message)"
    exit 1
}

$DataToSend = @()
foreach ($Member in $AdminMembers) {
    $MemberName = $Member.Name
    $MemberSource = $Member.PrincipalSource
    if (-not [string]::IsNullOrEmpty($MemberName)) {
        $DataToSend += [PSCustomObject]@{
            DeviceName = $DeviceName
            AdminName  = $MemberName
            PrincipalSource = $MemberSource
            TimeGenerated = (Get-Date -Format s)
        }
    }
}

if ($DataToSend.Count -eq 0) {
    Write-Host "No members found in the Administrators group. Skipping log submission."
    exit 0
}

$JsonPayload = $DataToSend | ConvertTo-Json -Depth 5

# ======================
# 3. Build Request and Signature
# ======================
$Bytes         = [System.Text.Encoding]::UTF8.GetBytes($JsonPayload)
$ContentLength = $Bytes.Length
$APIVersion    = "2016-04-01"
$Date          = (Get-Date).ToUniversalTime().ToString("r")
$ResourcePath  = "/api/logs"

# Build the string for signature (see MS Docs)
$SignatureString = "POST`n$ContentLength`napplication/json`nx-ms-date:$Date`n$ResourcePath"

# Decode Shared Key and calculate signature
try {
    $KeyBytes   = [Convert]::FromBase64String($SharedKey)
    $HMACSHA256 = New-Object System.Security.Cryptography.HMACSHA256
    $HMACSHA256.Key = $KeyBytes
    $Hash = $HMACSHA256.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($SignatureString))
    $Signature = [Convert]::ToBase64String($Hash)
} catch {
    Write-Error "Failed to create signature: $($_.Exception.Message)"
    exit 1
}

$Authorization = "SharedKey ${CustomerId}:$Signature"
$URI = "https://$CustomerID.ods.opinsights.azure.com/api/logs?api-version=$APIVersion"

# ======================
# 4. Send Data
# ======================
$Headers = @{
    "Authorization"        = $Authorization
    "x-ms-date"            = $Date
    "Content-Type"         = "application/json"
    "Log-Type"             = $LogType
    "x-ms-log-type"        = $LogType
    "time-generated-field" = "TimeGenerated"
}

try {
    Write-Host "Sending data to Log Analytics ($LogType)..."
    Write-Host "Target URI: $URI"
    $Response = Invoke-RestMethod -Uri $URI -Method Post -Headers $Headers -Body $JsonPayload
    Write-Host "Successfully sent log data."
} catch {
    Write-Error "Failed to send log data. Error: $($_.Exception.Message)"
    if ($_.Exception.Response) {
        try {
            $Reader = New-Object System.IO.StreamReader($_.Exception.Response.GetResponseStream())
            $Details = $Reader.ReadToEnd()
            Write-Error "Azure Response: $Details"
        } catch { }
    }
    exit 1
}

exit 0</pre>



<h2 class="wp-block-heading">2. Running the Script Daily via Intune</h2>



<p>To force the check daily, we deploy an Intune remediation script.</p>



<ol class="wp-block-list">
<li>Go to <a href="https://intune.microsoft.com" target="_blank" rel="noopener">https://intune.microsoft.com</a>.</li>



<li>Navigate to <strong>Devices > Scripts and remediations > Create</strong>.</li>



<li>Enter the above script as the <strong>Detection Script</strong> and leave the <strong>Remediation Script</strong> empty.</li>
</ol>



<figure class="wp-block-kadence-image kb-image3613_3b43a7-12 size-large border"><img decoding="async" width="1024" height="689" src="https://cyberillo.com/wp-content/uploads/Intune-Remediation-Script-Send-Local-Administrator-Group-Members-to-Log-Analytics-1024x689.png" alt="Intune-Remediation-Script-Send-Local-Administrator-Group-Members-to-Log-Analytics" class="kb-img wp-image-3619" srcset="https://cyberillo.com/wp-content/uploads/Intune-Remediation-Script-Send-Local-Administrator-Group-Members-to-Log-Analytics-1024x689.png 1024w, https://cyberillo.com/wp-content/uploads/Intune-Remediation-Script-Send-Local-Administrator-Group-Members-to-Log-Analytics-300x202.png 300w, https://cyberillo.com/wp-content/uploads/Intune-Remediation-Script-Send-Local-Administrator-Group-Members-to-Log-Analytics-768x516.png 768w, https://cyberillo.com/wp-content/uploads/Intune-Remediation-Script-Send-Local-Administrator-Group-Members-to-Log-Analytics.png 1227w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">3. Analyzing the Local Administrator Report</h2>



<p>Once the data is in our log analytics workspace, we use Kusto (KQL) to audit the results. The goal is to separate legitimate domain accounts from unauthorized user accounts that still have the local admin right.</p>



<h3 class="wp-block-heading">Compliance Summary</h3>



<p>This query counts the number of devices where a user is in the administrators group but does not have &#8220;admin&#8221; in their name (filtering out the built-in administrator and domain admins).</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">let allDevices = LocalAdminReport_CL | summarize by DeviceName_s;
let offenderDevices = LocalAdminReport_CL
    | where isnotempty(AdminName_s)
    | where AdminName_s !contains "Admin"
    | summarize by DeviceName_s;
let totalOffenders = offenderDevices 
    | summarize Count = count() 
    | extend Category = "Devices with Local Admin Access";
let compliantDevices = (allDevices
    | join kind=leftanti offenderDevices on DeviceName_s
    | summarize Count = count()
    | extend Category = "Compliant Devices"
);
totalOffenders
| union compliantDevices
| project Category, Count
| order by Category asc
</pre>



<h3 class="wp-block-heading">Detailed Account Audit</h3>



<p>Use this query to select and list every specific account that has been granted local admin permissions in the last 90 days across your computer fleet.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">LocalAdminReport_CL
| where TimeGenerated > ago(90d)
| where isnotempty(AdminName_s)
| where AdminName_s !contains "Admin"
| summarize LatestSeen = max(TimeGenerated) by DeviceName_s, AdminName_s
| order by DeviceName_s asc
</pre>



<h2 class="wp-block-heading">Implementation Tips</h2>



<ul class="wp-block-list">
<li><strong>Intune Deployment:</strong> Set the script to run daily using <strong>Devices &gt; Remediations</strong>. This ensures that if a user is added and then removed, your logs stay accurate.</li>



<li><strong>Filtering:</strong> Adjust the <code>!contains "Admin"</code> logic if your organization uses a different naming standard for authorized admin accounts.</li>



<li><strong>Workbook Visuals:</strong> In Azure Workbooks, use the &#8220;Pie Chart&#8221; renderer for the first query to get an immediate view of your environment&#8217;s health.</li>
</ul>



<h2 class="wp-block-heading">Summary</h2>



<p>Good security isn’t about saying “no” to everything. It’s about knowing what’s actually happening in your environment. With this script and report in place, you get a clear audit trail that shows exactly when someone is added as a local administrator. That way, “temporary” access doesn’t quietly turn into a permanent problem, and you stay in control instead of playing cleanup later.</p>
<p>The post <a rel="nofollow" href="https://cyberillo.com/local-admin-report/">Local Admin Report with Intune and Log Analytics</a> appeared first on <a rel="nofollow" href="https://cyberillo.com">Cyberillo</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cyberillo.com/local-admin-report/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Hybrid Azure AD Joined Device Fails Intune Auto Enrollment</title>
		<link>https://cyberillo.com/hybrid-azure-ad-joined-device-fails-intune-auto-enrollment/</link>
					<comments>https://cyberillo.com/hybrid-azure-ad-joined-device-fails-intune-auto-enrollment/#respond</comments>
		
		<dc:creator><![CDATA[Sylvan Abela]]></dc:creator>
		<pubDate>Thu, 08 Aug 2024 12:06:25 +0000</pubDate>
				<category><![CDATA[Intune]]></category>
		<guid isPermaLink="false">https://webbytips.com/?p=2864</guid>

					<description><![CDATA[<p>Trouble enrolling your hybrid joined Windows devices to Intune? Here's How to fix sync/authentication issues and enroll devices successfully.</p>
<p>The post <a rel="nofollow" href="https://cyberillo.com/hybrid-azure-ad-joined-device-fails-intune-auto-enrollment/">Hybrid Azure AD Joined Device Fails Intune Auto Enrollment</a> appeared first on <a rel="nofollow" href="https://cyberillo.com">Cyberillo</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Symptom</h2>



<p>A Windows device is joined to the domain and synchronized to Azure AD (Microsoft Entra). The <strong>Registered</strong> column for the device in Azure AD shows <em>Pending </em>and the <strong>MDM</strong> column shows <em>None</em>.</p>



<figure class="wp-block-image size-large border"><img decoding="async" width="1024" height="302" src="https://cyberillo.com/wp-content/uploads/MDM-shows-None-and-Registered-shows-Pending-in-Azure-AD-1024x302.png" alt="MDM shows None and Registered shows Pending in Azure AD" class="wp-image-2871" srcset="https://cyberillo.com/wp-content/uploads/MDM-shows-None-and-Registered-shows-Pending-in-Azure-AD-1024x302.png 1024w, https://cyberillo.com/wp-content/uploads/MDM-shows-None-and-Registered-shows-Pending-in-Azure-AD-300x89.png 300w, https://cyberillo.com/wp-content/uploads/MDM-shows-None-and-Registered-shows-Pending-in-Azure-AD-768x227.png 768w, https://cyberillo.com/wp-content/uploads/MDM-shows-None-and-Registered-shows-Pending-in-Azure-AD-1536x453.png 1536w, https://cyberillo.com/wp-content/uploads/MDM-shows-None-and-Registered-shows-Pending-in-Azure-AD-600x177.png 600w, https://cyberillo.com/wp-content/uploads/MDM-shows-None-and-Registered-shows-Pending-in-Azure-AD.png 1827w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>The device does not show up in Intune since it was not successfully enrolled.</p>



<p>Running <code>dsregcmd /status</code> in CMD<strong> </strong>shows:</p>



<p><code>AzureAdJoined : YES</code> [under Device State]



<p><code>DomainJoined : YES</code> [under Device State]



<p><code>AzureAdPrt : No</code> [under SSO State]



<p>The problem here is that <span style="text-decoration: underline;"><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">AzureAdPrt</mark> </span>(Primary Refresh Token) is showing <span style="text-decoration: underline;"><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">No</mark></span>. In a nutshell, this means that the device did not manage to authenticate successfully to Azure. Therefore, Intune auto-enrollment will fail. </p>



<p>You can confirm that device enrollment failed by checking for an error of the sort: &#8220;<em>Auto MDM Enroll Device Credential 0x0, Failed</em>&#8221; in the Event Viewer at the following location:</p>



<p><strong>Event Viewer → Applications and Services Logs → Microsoft → Windows → DeviceManagement-Enterprise-Diagnostics-Provider → Admin</strong></p>



<h2 class="wp-block-heading">Resolution</h2>



<ol class="wp-block-list">
<li>Make sure that you have checked all the <a href="https://learn.microsoft.com/en-us/mem/intune/enrollment/quickstart-setup-auto-enrollment" target="_blank" rel="noopener">prerequisites for Intune Auto Enrollment</a>.</li>



<li>In CMD (on the target device) run the following command:</li>
</ol>



<p><code>%windir%/System32/deviceenroller.exe /autoenrollmdm</code></p>



<p>In some cases, this one-liner does its magic and triggers a successful enrollment to Intune. If the device shows up in Intune after a while (5 to 15 minutes), the issue is resolved. If not, move on to the next steps to completely remove the device from your on-premises AD and Azure AD (Entra), re-join, and successfully enroll to Intune.</p>



<ol start="3" class="wp-block-list">
<li>In CMD (on the target device) run the following command to unregister from Azure AD.</li>
</ol>



<p><code>dsregcmd /leave</code></p>



<ol start="4" class="wp-block-list">
<li>Delete the device object from Azure AD.</li>
</ol>



<figure class="wp-block-image size-large border"><img loading="lazy" decoding="async" width="1024" height="378" src="https://cyberillo.com/wp-content/uploads/delete-device-from-Azure-AD-1024x378.png" alt="delete device from Azure AD" class="wp-image-2872" srcset="https://cyberillo.com/wp-content/uploads/delete-device-from-Azure-AD-1024x378.png 1024w, https://cyberillo.com/wp-content/uploads/delete-device-from-Azure-AD-300x111.png 300w, https://cyberillo.com/wp-content/uploads/delete-device-from-Azure-AD-768x283.png 768w, https://cyberillo.com/wp-content/uploads/delete-device-from-Azure-AD-600x221.png 600w, https://cyberillo.com/wp-content/uploads/delete-device-from-Azure-AD.png 1345w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<ol start="5" class="wp-block-list">
<li>Disjoin the device from the on-premises Active Directory domain.</li>



<li>Delete the device computer object from Active Directory.</li>
</ol>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="506" height="490" src="https://cyberillo.com/wp-content/uploads/delete-computer-object-in-Active-Directory.png" alt="" class="wp-image-2873" srcset="https://cyberillo.com/wp-content/uploads/delete-computer-object-in-Active-Directory.png 506w, https://cyberillo.com/wp-content/uploads/delete-computer-object-in-Active-Directory-300x291.png 300w" sizes="auto, (max-width: 506px) 100vw, 506px" /></figure>
</div>


<ol start="7" class="wp-block-list">
<li>Re-join the device to the domain and wait for the next synchronization cycle to Azure AD or force it through PowerShell on your AD Connect Server:</li>
</ol>



<p><code>Import-Module ADSync<br>Start-ADSyncSyncCycle -PolicyType Delta</code></p>



<ol start="8" class="wp-block-list">
<li>The device will show up in Azure AD.</li>



<li>Logon to the device with the target user’s credentials.</li>
</ol>



<p>After a while (5 to 15 minutes), the device will successfully enroll to Intune via auto-enrollment.</p>



<p>Running <code>dsregcmd /status</code> in CMD<strong> </strong>now<strong> </strong>shows:</p>



<p><code>AzureAdJoined : YES</code> [under Device State]



<p><code>DomainJoined : YES</code> [under Device State]



<p><code>AzureAdPrt : YES</code> [under SSO State]
<p>The post <a rel="nofollow" href="https://cyberillo.com/hybrid-azure-ad-joined-device-fails-intune-auto-enrollment/">Hybrid Azure AD Joined Device Fails Intune Auto Enrollment</a> appeared first on <a rel="nofollow" href="https://cyberillo.com">Cyberillo</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cyberillo.com/hybrid-azure-ad-joined-device-fails-intune-auto-enrollment/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
