diff --git a/src/Backend/AutopilotMonitor.Functions/DataAccess/TableStorage/TableAdminRepository.cs b/src/Backend/AutopilotMonitor.Functions/DataAccess/TableStorage/TableAdminRepository.cs index c5075bc2..8c9c2527 100644 --- a/src/Backend/AutopilotMonitor.Functions/DataAccess/TableStorage/TableAdminRepository.cs +++ b/src/Backend/AutopilotMonitor.Functions/DataAccess/TableStorage/TableAdminRepository.cs @@ -828,7 +828,7 @@ namespace AutopilotMonitor.Functions.DataAccess.TableStorage { template.Name = entity.Name; template.CreatedBy = entity.CreatedBy; - template.CreatedAt = entity.CreatedDate; + template.CreatedAt = entity.CreatedDate ?? default; return true; } diff --git a/src/Backend/AutopilotMonitor.Functions/Services/DelegatedAdminService.cs b/src/Backend/AutopilotMonitor.Functions/Services/DelegatedAdminService.cs index bf170ec9..f594b8fb 100644 --- a/src/Backend/AutopilotMonitor.Functions/Services/DelegatedAdminService.cs +++ b/src/Backend/AutopilotMonitor.Functions/Services/DelegatedAdminService.cs @@ -414,8 +414,12 @@ public class TenantTemplateEntity : ITableEntity /// UPN of the GlobalAdmin who created the template (meta row only). public string CreatedBy { get; set; } = string.Empty; - /// When the template was created (meta row only). - public DateTime CreatedDate { get; set; } + /// + /// When the template was created (meta row only). NULLABLE on purpose: membership rows leave it unset, and + /// Azure Table Storage rejects a default(DateTime) (0001-01-01) — below the Edm.DateTime minimum of 1601 — + /// which would make every membership-row write throw. A null DateTime? is simply omitted (valid). + /// + public DateTime? CreatedDate { get; set; } /// The managed tenant ID (lowercase) — denormalized copy of RowKey on membership rows; empty on meta. public string TenantId { get; set; } = string.Empty;