Skip to content

Feat: Add Autopilot Deployments report #4325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/layouts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ export const nativeMenuItems = [
items: [
{ title: "Analytics Device Score", path: "/endpoint/reports/analyticsdevicescore" },
{ title: "Work from anywhere", path: "/endpoint/reports/workfromanywhere" },
{ title: "Autopilot Deployments", path: "/endpoint/reports/autopilot-deployment" },
],
},
],
Expand Down
112 changes: 112 additions & 0 deletions src/pages/endpoint/reports/autopilot-deployment/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import { EyeIcon, DocumentTextIcon } from "@heroicons/react/24/outline";
import { Layout as DashboardLayout } from "/src/layouts/index.js";
import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx";
import { useSettings } from "/src/hooks/use-settings";
import { CheckCircle, Error, Warning, Refresh } from "@mui/icons-material";

const Page = () => {
const pageTitle = "Autopilot Deployments";
const tenantFilter = useSettings().currentTenant;

// Actions for viewing device in Intune and deployment details
const actions = [
{
label: "View Device in Intune",
link: `https://intune.microsoft.com/${tenantFilter}/#view/Microsoft_Intune_Devices/DeviceSettingsMenuBlade/~/overview/mdmDeviceId/[deviceId]`,
color: "info",
icon: <EyeIcon />,
target: "_blank",
multiPost: false,
external: true,
},
{
label: "View Deployment Details",
link: `https://intune.microsoft.com/${tenantFilter}/#view/Microsoft_Intune_DeviceSettings/DeploymentOverviewMenuBlade/~/autopilotDeployment/deploymentProfileId/[windowsAutopilotDeploymentProfileDisplayName]`,
color: "info",
icon: <DocumentTextIcon />,
target: "_blank",
multiPost: false,
external: true,
},
];

// Extended info fields for the off-canvas panel
const offCanvas = {
extendedInfoFields: [
"id",
"deviceId",
"userId",
"eventDateTime",
"deviceRegisteredDateTime",
"enrollmentStartDateTime",
"enrollmentType",
"deviceSerialNumber",
"managedDeviceName",
"userPrincipalName",
"windowsAutopilotDeploymentProfileDisplayName",
"enrollmentState",
"windows10EnrollmentCompletionPageConfigurationDisplayName",
"deploymentState",
"deviceSetupStatus",
"accountSetupStatus",
"osVersion",
"deploymentDuration",
"deploymentTotalDuration",
"deviceSetupDuration",
"accountSetupDuration",
"deploymentStartDateTime",
"deploymentEndDateTime",
"enrollmentFailureDetails",
],
actions: actions,
};

// Columns to be displayed in the table (most important first)
const simpleColumns = [
"managedDeviceName",
"eventDateTime",
"deviceSerialNumber",
"userPrincipalName",
"deploymentState",
"enrollmentState",
"enrollmentType",
"deploymentTotalDuration",
"windowsAutopilotDeploymentProfileDisplayName",
"enrollmentFailureDetails",
];

// Predefined filters for common deployment scenarios
const filterList = [
{
filterName: "Failed Deployments",
value: [{ id: "deploymentState", value: "failed" }],
type: "column",
},
{
filterName: "Successful Deployments",
value: [{ id: "deploymentState", value: "success" }],
type: "column",
},
];

return (
<CippTablePage
title={pageTitle}
apiUrl="/api/ListGraphRequest"
apiData={{
endpoint: "deviceManagement/autopilotEvents",
$orderBy: "enrollmentStartDateTime desc",
$top: 999,
}}
apiDataKey="Results"
actions={actions}
offCanvas={offCanvas}
simpleColumns={simpleColumns}
filters={filterList}
/>
);
};

Page.getLayout = (page) => <DashboardLayout>{page}</DashboardLayout>;

export default Page;
12 changes: 11 additions & 1 deletion src/utils/get-cipp-formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,17 @@ export const getCippFormatting = (data, cellName, type, canReceive, flatten = tr
);
}

const durationArray = ["autoExtendDuration"];
// ISO 8601 Duration Formatting
// Add property names here to automatically format ISO 8601 duration strings (e.g., "PT1H23M30S")
// into human-readable format (e.g., "1 hour 23 minutes 30 seconds") across all CIPP tables.
// This works for any API response property that contains ISO 8601 duration format.
const durationArray = [
"autoExtendDuration", // GDAP page (/tenant/gdap-management/relationships)
"deploymentDuration", // AutoPilot deployments (/endpoint/reports/autopilot-deployment)
"deploymentTotalDuration", // AutoPilot deployments (/endpoint/reports/autopilot-deployment)
"deviceSetupDuration", // AutoPilot deployments (/endpoint/reports/autopilot-deployment)
"accountSetupDuration" // AutoPilot deployments (/endpoint/reports/autopilot-deployment)
];
if (durationArray.includes(cellName)) {
isoDuration.setLocales(
{
Expand Down
Loading