Files
vigil365/database/schema.sql
T
Samir KhanandClaude Sonnet 4.6 54ad152f31 Initial commit: M365 Security Alert Dashboard
Full-stack Microsoft 365 security monitoring dashboard built with
ASP.NET Core 8 + React 18 + TypeScript. Aggregates security signals
from Microsoft Graph API across Defender XDR, Entra ID Protection,
Intune, Exchange Online, and M365 Compliance into a single
self-hosted dashboard.

Features:
- 13 monitoring pages: Identity, Devices, Email, Incidents, Compliance,
  Service Health, Licenses, Conditional Access, Audit Log, Sign-in Locations,
  M365 Connectivity, Alert Center, Overview
- Alert Policy Engine with 9 pre-built templates and custom policy builder
- Detail modals with direct M365 portal deep links per item type
- Per-page search, filter, sort, CSV export, saved filter presets
- Dark/light mode, collapsible sidebar, toast notifications
- Responsive layout, sticky filter bars, sortable table columns

All credentials must be supplied via .NET User Secrets (dev) or
appsettings.Production.json (prod) — never committed to source.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-16 21:41:48 +05:30

54 lines
1.7 KiB
Transact-SQL

IF DB_ID(N'M365SecurityDashboard') IS NULL
BEGIN
CREATE DATABASE M365SecurityDashboard;
END
GO
USE M365SecurityDashboard;
GO
IF OBJECT_ID(N'dbo.SecurityAlerts', N'U') IS NULL
BEGIN
CREATE TABLE dbo.SecurityAlerts
(
Id BIGINT IDENTITY(1,1) NOT NULL CONSTRAINT PK_SecurityAlerts PRIMARY KEY,
ExternalId NVARCHAR(256) NULL,
AlertType NVARCHAR(120) NOT NULL,
Service INT NOT NULL,
Severity INT NOT NULL,
Title NVARCHAR(512) NOT NULL,
Description NVARCHAR(4000) NULL,
UserPrincipalName NVARCHAR(320) NULL,
DeviceName NVARCHAR(256) NULL,
PortalUrl NVARCHAR(2048) NULL,
DetectedAt DATETIMEOFFSET NOT NULL,
LastUpdatedAt DATETIMEOFFSET NOT NULL,
IsResolved BIT NOT NULL CONSTRAINT DF_SecurityAlerts_IsResolved DEFAULT 0,
RawJson NVARCHAR(MAX) NOT NULL
);
CREATE UNIQUE INDEX UX_SecurityAlerts_SourceExternalId
ON dbo.SecurityAlerts(Service, AlertType, ExternalId)
WHERE ExternalId IS NOT NULL;
CREATE INDEX IX_SecurityAlerts_DetectedAt ON dbo.SecurityAlerts(DetectedAt);
CREATE INDEX IX_SecurityAlerts_ServiceSeverityResolved ON dbo.SecurityAlerts(Service, Severity, IsResolved);
END
GO
IF OBJECT_ID(N'dbo.CollectionRuns', N'U') IS NULL
BEGIN
CREATE TABLE dbo.CollectionRuns
(
Id BIGINT IDENTITY(1,1) NOT NULL CONSTRAINT PK_CollectionRuns PRIMARY KEY,
StartedAt DATETIMEOFFSET NOT NULL,
CompletedAt DATETIMEOFFSET NULL,
Status INT NOT NULL,
AlertsUpserted INT NOT NULL,
SourceFailures INT NOT NULL,
Error NVARCHAR(4000) NULL
);
CREATE INDEX IX_CollectionRuns_StartedAt ON dbo.CollectionRuns(StartedAt);
END
GO