using Microsoft.EntityFrameworkCore; using Microsoft.SelfService.Portal.Core.API.Models; namespace Microsoft.SelfService.Portal.Core.API.Context { internal static partial class DemoData { private static readonly DateTime Timestamp = new(2026, 7, 7, 0, 0, 0, DateTimeKind.Utc); private const string Owner = "DemoSeed"; internal static readonly Guid EnvironmentContosoTestId = Guid.Parse("10000000-0000-0000-0000-000000000001"); internal static readonly Guid EnvironmentContosoProdId = Guid.Parse("10000000-0000-0000-0000-000000000002"); internal static readonly Guid EnvironmentM365Id = Guid.Parse("10000000-0000-0000-0000-000000000003"); internal static readonly Guid DomainCentralId = Guid.Parse("20000000-0000-0000-0000-000000000001"); internal static readonly Guid DomainResourceId = Guid.Parse("20000000-0000-0000-0000-000000000002"); internal static readonly Guid VmDc01Id = Guid.Parse("30000000-0000-0000-0000-000000000001"); internal static readonly Guid VmDc02Id = Guid.Parse("30000000-0000-0000-0000-000000000002"); internal static readonly Guid VmSql01Id = Guid.Parse("30000000-0000-0000-0000-000000000003"); internal static readonly Guid VmSp01Id = Guid.Parse("30000000-0000-0000-0000-000000000004"); internal static readonly Guid VmSp02Id = Guid.Parse("30000000-0000-0000-0000-000000000005"); internal static readonly Guid TargetM365TenantId = Guid.Parse("30000000-0000-0000-0000-000000000006"); internal static readonly Guid TargetTeamsPolicyScopeId = Guid.Parse("30000000-0000-0000-0000-000000000007"); internal static readonly Guid TargetBgwSp01Id = Guid.Parse("30000000-0000-0000-0000-000000000101"); internal static readonly Guid TargetBgwSp02Id = Guid.Parse("30000000-0000-0000-0000-000000000102"); internal static readonly Guid TargetBgwSp03Id = Guid.Parse("30000000-0000-0000-0000-000000000103"); internal static readonly Guid ServiceActiveDirectoryId = Guid.Parse("40000000-0000-0000-0000-000000000001"); internal static readonly Guid ServiceSqlServerId = Guid.Parse("40000000-0000-0000-0000-000000000002"); internal static readonly Guid ServiceSharePointId = Guid.Parse("40000000-0000-0000-0000-000000000003"); internal static readonly Guid ServiceTeamsId = Guid.Parse("40000000-0000-0000-0000-000000000004"); internal static readonly Guid ServiceConfigurationDataId = Guid.Parse("40000000-0000-0000-0000-000000000101"); internal static readonly Guid CategoryActiveDirectoryId = Guid.Parse("50000000-0000-0000-0000-000000000001"); internal static readonly Guid CategorySqlServerId = Guid.Parse("50000000-0000-0000-0000-000000000002"); internal static readonly Guid CategorySharePointId = Guid.Parse("50000000-0000-0000-0000-000000000003"); internal static readonly Guid CategoryTeamsId = Guid.Parse("50000000-0000-0000-0000-000000000004"); internal static readonly Guid CategoryBgwMergeTemplatesId = Guid.Parse("50000000-0000-0000-0000-000000000101"); internal static readonly Guid RuleStandardId = Guid.Parse("60000000-0000-0000-0000-000000000001"); internal static readonly Guid RuleStepValidateId = Guid.Parse("60000000-0000-0000-0000-000000000101"); internal static readonly Guid RuleStepApproveId = Guid.Parse("60000000-0000-0000-0000-000000000102"); internal static readonly Guid RuleStepDeployId = Guid.Parse("60000000-0000-0000-0000-000000000103"); internal static readonly Guid TemplateActiveDirectoryId = Guid.Parse("70000000-0000-0000-0000-000000000001"); internal static readonly Guid TemplateSqlServerId = Guid.Parse("70000000-0000-0000-0000-000000000002"); internal static readonly Guid TemplateSharePointId = Guid.Parse("70000000-0000-0000-0000-000000000003"); internal static readonly Guid TemplateTeamsId = Guid.Parse("70000000-0000-0000-0000-000000000004"); internal static readonly Guid TemplateBgwEnvironmentTestId = Guid.Parse("70000000-0000-0000-0000-000000000101"); internal static readonly Guid TemplateBgwDomainContosoId = Guid.Parse("70000000-0000-0000-0000-000000000102"); internal static readonly Guid TemplateBgwSharePointContosoId = Guid.Parse("70000000-0000-0000-0000-000000000103"); internal static readonly Guid TemplateBgwStageInstallId = Guid.Parse("70000000-0000-0000-0000-000000000104"); internal static readonly Guid TemplateActiveDirectoryVersionId = Guid.Parse("71000000-0000-0000-0000-000000000001"); internal static readonly Guid TemplateSqlServerVersionId = Guid.Parse("71000000-0000-0000-0000-000000000002"); internal static readonly Guid TemplateSharePointVersionId = Guid.Parse("71000000-0000-0000-0000-000000000003"); internal static readonly Guid TemplateTeamsVersionId = Guid.Parse("71000000-0000-0000-0000-000000000004"); internal static readonly Guid TemplateBgwEnvironmentTestVersionId = Guid.Parse("71000000-0000-0000-0000-000000000101"); internal static readonly Guid TemplateBgwDomainContosoVersionId = Guid.Parse("71000000-0000-0000-0000-000000000102"); internal static readonly Guid TemplateBgwSharePointContosoVersionId = Guid.Parse("71000000-0000-0000-0000-000000000103"); internal static readonly Guid TemplateBgwStageInstallVersionId = Guid.Parse("71000000-0000-0000-0000-000000000104"); internal static readonly Guid DeploymentBatchSharePointId = Guid.Parse("80000000-0000-0000-0000-000000000001"); internal static readonly Guid DeploymentBatchBgwMergeId = Guid.Parse("80000000-0000-0000-0000-000000000101"); internal static readonly Guid DeploymentSp01Id = Guid.Parse("81000000-0000-0000-0000-000000000001"); internal static readonly Guid DeploymentSp02Id = Guid.Parse("81000000-0000-0000-0000-000000000002"); internal static readonly Guid DeploymentBgwSp01Id = Guid.Parse("81000000-0000-0000-0000-000000000101"); internal static readonly Guid DeploymentBgwSp02Id = Guid.Parse("81000000-0000-0000-0000-000000000102"); internal static readonly Guid DeploymentBgwSp03Id = Guid.Parse("81000000-0000-0000-0000-000000000103"); internal static readonly Guid DeploymentSharePointTemplateSelectionId = Guid.Parse("82000000-0000-0000-0000-000000000001"); internal static readonly Guid DeploymentBgwEnvironmentSelectionId = Guid.Parse("82000000-0000-0000-0000-000000000101"); internal static readonly Guid DeploymentBgwDomainSelectionId = Guid.Parse("82000000-0000-0000-0000-000000000102"); internal static readonly Guid DeploymentBgwSharePointSelectionId = Guid.Parse("82000000-0000-0000-0000-000000000103"); internal static readonly Guid DeploymentBgwStageSelectionId = Guid.Parse("82000000-0000-0000-0000-000000000104"); internal static readonly Guid DeploymentParameterDatabasePrefixId = Guid.Parse("83000000-0000-0000-0000-000000000001"); internal static readonly Guid DeploymentParameterFarmAccountId = Guid.Parse("83000000-0000-0000-0000-000000000002"); internal static readonly Guid DeploymentTargetSp01Id = Guid.Parse("84000000-0000-0000-0000-000000000001"); internal static readonly Guid DeploymentTargetSp02Id = Guid.Parse("84000000-0000-0000-0000-000000000002"); internal static readonly Guid DeploymentTargetBgwSp01Id = Guid.Parse("84000000-0000-0000-0000-000000000101"); internal static readonly Guid DeploymentTargetBgwSp02Id = Guid.Parse("84000000-0000-0000-0000-000000000102"); internal static readonly Guid DeploymentTargetBgwSp03Id = Guid.Parse("84000000-0000-0000-0000-000000000103"); internal static void Seed(ModelBuilder modelBuilder) { modelBuilder.Entity().HasData(Environments()); modelBuilder.Entity().HasData(Domains()); modelBuilder.Entity().HasData(EnvironmentDomains()); modelBuilder.Entity().HasData(Targets()); modelBuilder.Entity().HasData(Services()); modelBuilder.Entity().HasData(ServiceRoleDefinitions()); modelBuilder.Entity().HasData(TemplateCategories()); modelBuilder.Entity().HasData(DeploymentRules()); modelBuilder.Entity().HasData(DeploymentRuleSteps()); modelBuilder.Entity().HasData(Templates()); modelBuilder.Entity().HasData(TemplateVersions()); modelBuilder.Entity().HasData(DeploymentBatches()); modelBuilder.Entity().HasData(Deployments()); modelBuilder.Entity().HasData(DeploymentTemplateSelections()); modelBuilder.Entity().HasData(DeploymentParameterValues()); modelBuilder.Entity().HasData(DeploymentTargetAssignments()); } private static object[] Environments() => [ Base(new EnvironmentModel { Id = EnvironmentContosoTestId, Name = "Contoso Test", EnvironmentType = EnvironmentStages.Test, HostingType = EnvironmentHostingTypes.OnPrem, MetadataJson = "{\"location\":\"Datacenter A\"}" }), Base(new EnvironmentModel { Id = EnvironmentContosoProdId, Name = "Contoso Production", EnvironmentType = EnvironmentStages.Production, HostingType = EnvironmentHostingTypes.OnPrem, MetadataJson = "{\"location\":\"Datacenter A\"}" }), Base(new EnvironmentModel { Id = EnvironmentM365Id, Name = "Contoso M365", EnvironmentType = EnvironmentStages.Production, HostingType = EnvironmentHostingTypes.M365Tenant, ProviderType = "Microsoft365", TenantId = "11111111-1111-1111-1111-111111111111", MetadataJson = "{\"tenant\":\"contoso.onmicrosoft.com\"}" }) ]; private static object[] Domains() => [ Base(new DomainModel { Id = DomainCentralId, Name = "Central Management", FQDN = "corp.contoso.com", NetBIOS = "CONTOSO" }), Base(new DomainModel { Id = DomainResourceId, Name = "Resource Domain", FQDN = "resource.contoso.com", NetBIOS = "RESOURCE" }) ]; private static object[] EnvironmentDomains() => [ Junction(new EnvironmentDomainsModel { EnvironmentId = EnvironmentContosoTestId, DomainId = DomainCentralId }), Junction(new EnvironmentDomainsModel { EnvironmentId = EnvironmentContosoProdId, DomainId = DomainCentralId }), Junction(new EnvironmentDomainsModel { EnvironmentId = EnvironmentContosoProdId, DomainId = DomainResourceId }) ]; private static object[] Targets() => [ Base(new TargetModel { Id = VmDc01Id, DomainID = DomainCentralId, Name = "CT-DC-01", TargetType = "VirtualMachine", ProviderType = "OnPrem", MetadataJson = "{\"role\":\"DomainController\",\"environment\":\"Test\"}" }), Base(new TargetModel { Id = VmDc02Id, DomainID = DomainCentralId, Name = "CT-DC-02", TargetType = "VirtualMachine", ProviderType = "OnPrem", MetadataJson = "{\"role\":\"DomainController\",\"environment\":\"Production\"}" }), Base(new TargetModel { Id = VmSql01Id, DomainID = DomainCentralId, Name = "CT-SQL-01", TargetType = "VirtualMachine", ProviderType = "OnPrem", MetadataJson = "{\"role\":\"SqlServer\",\"environment\":\"Test\"}" }), Base(new TargetModel { Id = VmSp01Id, DomainID = DomainCentralId, Name = "CT-SHP-01", TargetType = "VirtualMachine", ProviderType = "OnPrem", MetadataJson = "{\"role\":\"SharePoint\",\"environment\":\"Test\"}" }), Base(new TargetModel { Id = VmSp02Id, DomainID = DomainCentralId, Name = "CT-SHP-02", TargetType = "VirtualMachine", ProviderType = "OnPrem", MetadataJson = "{\"role\":\"SharePoint\",\"environment\":\"Test\"}" }), Base(new TargetModel { Id = TargetM365TenantId, Name = "contoso.onmicrosoft.com", TargetType = "Tenant", ProviderType = "Microsoft365", ExternalId = "11111111-1111-1111-1111-111111111111", MetadataJson = "{\"environment\":\"Production\",\"workload\":\"M365\"}" }), Base(new TargetModel { Id = TargetTeamsPolicyScopeId, Name = "Teams - Standard Users", TargetType = "PolicyScope", ProviderType = "Microsoft365", ExternalId = "Teams.StandardUsers", MetadataJson = "{\"workload\":\"Teams\",\"scope\":\"StandardUsers\"}" }), Base(new TargetModel { Id = TargetBgwSp01Id, DomainID = DomainCentralId, Name = "CLD-SHP-01", TargetType = "VirtualMachine", ProviderType = "OnPrem", MetadataJson = "{\"role\":\"SharePoint\",\"environment\":\"Test\",\"source\":\"Test.Merge.ps1\"}" }), Base(new TargetModel { Id = TargetBgwSp02Id, DomainID = DomainCentralId, Name = "CLD-SHP-02", TargetType = "VirtualMachine", ProviderType = "OnPrem", MetadataJson = "{\"role\":\"SharePoint\",\"environment\":\"Test\",\"source\":\"Test.Merge.ps1\"}" }), Base(new TargetModel { Id = TargetBgwSp03Id, DomainID = DomainCentralId, Name = "CLD-SHP-03", TargetType = "VirtualMachine", ProviderType = "OnPrem", MetadataJson = "{\"role\":\"SharePoint\",\"environment\":\"Test\",\"source\":\"Test.Merge.ps1\"}" }) ]; private static object[] Services() => [ Base(new ServiceModel { Id = ServiceActiveDirectoryId, Name = "Active Directory", Description = "On-premises directory and identity service.", IconKey = "network", IsCloudService = false }), Base(new ServiceModel { Id = ServiceSqlServerId, Name = "SQL Server", Description = "Database platform for application workloads.", IconKey = "database", IsCloudService = false }), Base(new ServiceModel { Id = ServiceSharePointId, Name = "SharePoint Server", Description = "Collaboration platform for on-premises workloads.", IconKey = "sharepoint", IsCloudService = false }), Base(new ServiceModel { Id = ServiceTeamsId, Name = "Microsoft Teams", Description = "Cloud collaboration workload in Microsoft 365.", IconKey = "messages-square", IsCloudService = true }), Base(new ServiceModel { Id = ServiceConfigurationDataId, Name = "DSC Configuration Data", Description = "Reusable configuration-data template building blocks for deployment composition.", IconKey = "braces", IsCloudService = false }) ]; private static object[] ServiceRoleDefinitions() => [ Base(new ServiceRoleDefinitionModel { Id = Guid.Parse("41000000-0000-0000-0000-000000000001"), ServiceId = ServiceSharePointId, Key = "Farm", Name = "Farm", Description = "SharePoint farm role." }), Base(new ServiceRoleDefinitionModel { Id = Guid.Parse("41000000-0000-0000-0000-000000000002"), ServiceId = ServiceSharePointId, Key = "WebFrontEnd", Name = "Web Front End", Description = "SharePoint web front-end role." }), Base(new ServiceRoleDefinitionModel { Id = Guid.Parse("41000000-0000-0000-0000-000000000003"), ServiceId = ServiceSharePointId, Key = "Application", Name = "Application", Description = "SharePoint service application role." }), Base(new ServiceRoleDefinitionModel { Id = Guid.Parse("41000000-0000-0000-0000-000000000004"), ServiceId = ServiceSqlServerId, Key = "Database", Name = "Database", Description = "SQL Server database role." }) ]; private static object[] TemplateCategories() => [ Base(new TemplateCategoryModel { Id = CategoryActiveDirectoryId, ServiceId = ServiceActiveDirectoryId, Name = "Domain Services", Description = "Templates for domain controller and domain configuration.", Color = "#2563EB", IsActive = true }), Base(new TemplateCategoryModel { Id = CategorySqlServerId, ServiceId = ServiceSqlServerId, Name = "Database Platform", Description = "Templates for SQL Server workloads.", Color = "#16A34A", IsActive = true }), Base(new TemplateCategoryModel { Id = CategorySharePointId, ServiceId = ServiceSharePointId, Name = "Collaboration Farm", Description = "Templates for SharePoint Server farms.", Color = "#0F766E", IsActive = true }), Base(new TemplateCategoryModel { Id = CategoryTeamsId, ServiceId = ServiceTeamsId, Name = "Teams Policies", Description = "Templates for Teams policy configuration.", Color = "#7C3AED", IsActive = true }), Base(new TemplateCategoryModel { Id = CategoryBgwMergeTemplatesId, ServiceId = ServiceConfigurationDataId, Name = "Test.Merge.ps1 Templates", Description = "Materialized template building blocks from the BGW Test.Merge.ps1 scenario.", Color = "#2563EB", IsActive = true }) ]; private static object[] DeploymentRules() => [ Base(new DeploymentRuleModel { Id = RuleStandardId, Name = "Standard Provisioning", Description = "Validate input, wait for approval, then provision targets.", IsActive = true }) ]; private static object[] DeploymentRuleSteps() => [ Base(new DeploymentRuleStepModel { Id = RuleStepValidateId, DeploymentRuleId = RuleStandardId, SortOrder = 10, Name = "Validate configuration", StepType = QueueJobStepType.Provision, RequiresApproval = false, MetadataJson = "{\"action\":\"validate\"}" }), Base(new DeploymentRuleStepModel { Id = RuleStepApproveId, DeploymentRuleId = RuleStandardId, SortOrder = 20, Name = "Approve deployment", StepType = QueueJobStepType.Approval, RequiresApproval = true, MetadataJson = "{\"approverGroup\":\"Platform Owners\"}" }), Base(new DeploymentRuleStepModel { Id = RuleStepDeployId, DeploymentRuleId = RuleStandardId, SortOrder = 30, Name = "Provision workload", StepType = QueueJobStepType.Provision, RequiresApproval = false, MetadataJson = "{\"action\":\"deploy\"}" }) ]; private static object[] Templates() => [ Base(new TemplateModel { Id = TemplateActiveDirectoryId, TemplateCategoryId = CategoryActiveDirectoryId, DeploymentRuleId = RuleStandardId, Name = "Contoso Active Directory Domain", Version = "1.0.0", Description = "Creates a reusable Active Directory domain baseline.", JSONData = ActiveDirectoryTemplateJson }), Base(new TemplateModel { Id = TemplateSqlServerId, TemplateCategoryId = CategorySqlServerId, DeploymentRuleId = RuleStandardId, Name = "Contoso SQL Server", Version = "1.0.0", Description = "Creates a SQL Server baseline for application workloads.", JSONData = SqlServerTemplateJson }), Base(new TemplateModel { Id = TemplateSharePointId, TemplateCategoryId = CategorySharePointId, DeploymentRuleId = RuleStandardId, Name = "Contoso SharePoint Server", Version = "1.0.0", Description = "Creates a SharePoint Server farm baseline.", JSONData = SharePointTemplateJson }), Base(new TemplateModel { Id = TemplateTeamsId, TemplateCategoryId = CategoryTeamsId, DeploymentRuleId = RuleStandardId, Name = "Contoso Teams Policies", Version = "1.0.0", Description = "Creates a Microsoft Teams policy baseline.", JSONData = TeamsTemplateJson }), Base(new TemplateModel { Id = TemplateBgwEnvironmentTestId, TemplateCategoryId = CategoryBgwMergeTemplatesId, DeploymentRuleId = RuleStandardId, Name = "BGW Environment Test", Version = "1.0.0", Description = "Materialized Environment/Test.psd1 template from Test.Merge.ps1.", JSONData = BgwEnvironmentTestTemplateJson }), Base(new TemplateModel { Id = TemplateBgwDomainContosoId, TemplateCategoryId = CategoryBgwMergeTemplatesId, DeploymentRuleId = RuleStandardId, Name = "BGW Domain Contoso", Version = "1.0.0", Description = "Materialized Domain/Contoso.psd1 template from Test.Merge.ps1.", JSONData = BgwDomainContosoTemplateJson }), Base(new TemplateModel { Id = TemplateBgwSharePointContosoId, TemplateCategoryId = CategoryBgwMergeTemplatesId, DeploymentRuleId = RuleStandardId, Name = "BGW SharePoint Contoso", Version = "1.0.0", Description = "Materialized Service/SharePoint/Contoso.psd1 template from Test.Merge.ps1.", JSONData = BgwSharePointContosoTemplateJson }), Base(new TemplateModel { Id = TemplateBgwStageInstallId, TemplateCategoryId = CategoryBgwMergeTemplatesId, DeploymentRuleId = RuleStandardId, Name = "BGW Stage Install", Version = "1.0.0", Description = "Materialized Stage/Install.psd1 template from Test.Merge.ps1.", JSONData = BgwStageInstallTemplateJson }) ]; private static object[] TemplateVersions() => [ TemplateVersion(TemplateActiveDirectoryVersionId, TemplateActiveDirectoryId, ActiveDirectoryTemplateJson), TemplateVersion(TemplateSqlServerVersionId, TemplateSqlServerId, SqlServerTemplateJson), TemplateVersion(TemplateSharePointVersionId, TemplateSharePointId, SharePointTemplateJson), TemplateVersion(TemplateTeamsVersionId, TemplateTeamsId, TeamsTemplateJson), TemplateVersion(TemplateBgwEnvironmentTestVersionId, TemplateBgwEnvironmentTestId, BgwEnvironmentTestTemplateJson), TemplateVersion(TemplateBgwDomainContosoVersionId, TemplateBgwDomainContosoId, BgwDomainContosoTemplateJson), TemplateVersion(TemplateBgwSharePointContosoVersionId, TemplateBgwSharePointContosoId, BgwSharePointContosoTemplateJson), TemplateVersion(TemplateBgwStageInstallVersionId, TemplateBgwStageInstallId, BgwStageInstallTemplateJson) ]; private static object[] DeploymentBatches() => [ Base(new DeploymentGroupModel { Id = DeploymentBatchSharePointId, TemplateId = TemplateSharePointId, DeploymentRuleId = RuleStandardId, Status = QueueJobStatus.Pending }), Base(new DeploymentGroupModel { Id = DeploymentBatchBgwMergeId, TemplateId = TemplateBgwSharePointContosoId, DeploymentRuleId = RuleStandardId, Status = QueueJobStatus.Pending }) ]; private static object[] Deployments() => [ Base(new DeploymentModel { Id = DeploymentSp01Id, DeploymentGroupId = DeploymentBatchSharePointId, TargetId = VmSp01Id, Status = QueueJobStatus.Pending, JSONData = "{\"role\":\"WebFrontEnd\"}" }), Base(new DeploymentModel { Id = DeploymentSp02Id, DeploymentGroupId = DeploymentBatchSharePointId, TargetId = VmSp02Id, Status = QueueJobStatus.Pending, JSONData = "{\"role\":\"Application\"}" }), Base(new DeploymentModel { Id = DeploymentBgwSp01Id, DeploymentGroupId = DeploymentBatchBgwMergeId, TargetId = TargetBgwSp01Id, Status = QueueJobStatus.Pending, JSONData = "{\"role\":\"Node\"}" }), Base(new DeploymentModel { Id = DeploymentBgwSp02Id, DeploymentGroupId = DeploymentBatchBgwMergeId, TargetId = TargetBgwSp02Id, Status = QueueJobStatus.Pending, JSONData = "{\"role\":\"Node\"}" }), Base(new DeploymentModel { Id = DeploymentBgwSp03Id, DeploymentGroupId = DeploymentBatchBgwMergeId, TargetId = TargetBgwSp03Id, Status = QueueJobStatus.Pending, JSONData = "{\"role\":\"Node\"}" }) ]; private static object[] DeploymentTemplateSelections() => [ Base(new DeploymentTemplateSelectionModel { Id = DeploymentSharePointTemplateSelectionId, DeploymentGroupId = DeploymentBatchSharePointId, TemplateVersionId = TemplateSharePointVersionId, TemplateRole = "Service", SortOrder = 10, Alias = "SharePoint" }), Base(new DeploymentTemplateSelectionModel { Id = DeploymentBgwEnvironmentSelectionId, DeploymentGroupId = DeploymentBatchBgwMergeId, TemplateVersionId = TemplateBgwEnvironmentTestVersionId, TemplateRole = "Environment", SortOrder = 10, Alias = "Environment-Test" }), Base(new DeploymentTemplateSelectionModel { Id = DeploymentBgwDomainSelectionId, DeploymentGroupId = DeploymentBatchBgwMergeId, TemplateVersionId = TemplateBgwDomainContosoVersionId, TemplateRole = "Domain", SortOrder = 20, Alias = "Domain-Contoso" }), Base(new DeploymentTemplateSelectionModel { Id = DeploymentBgwSharePointSelectionId, DeploymentGroupId = DeploymentBatchBgwMergeId, TemplateVersionId = TemplateBgwSharePointContosoVersionId, TemplateRole = "Service", SortOrder = 30, Alias = "Service-SharePoint-Contoso" }), Base(new DeploymentTemplateSelectionModel { Id = DeploymentBgwStageSelectionId, DeploymentGroupId = DeploymentBatchBgwMergeId, TemplateVersionId = TemplateBgwStageInstallVersionId, TemplateRole = "Stage", SortOrder = 40, Alias = "Stage-Install" }) ]; private static object[] DeploymentParameterValues() => [ Base(new DeploymentParameterValueModel { Id = DeploymentParameterDatabasePrefixId, DeploymentGroupId = DeploymentBatchSharePointId, DeploymentTemplateSelectionId = DeploymentSharePointTemplateSelectionId, Name = "DatabasePrefix", ValueJson = "{\"value\":\"SharePoint_Contoso_Test\"}", IsOverride = true, IsSecretReference = false }), Base(new DeploymentParameterValueModel { Id = DeploymentParameterFarmAccountId, DeploymentGroupId = DeploymentBatchSharePointId, DeploymentTemplateSelectionId = DeploymentSharePointTemplateSelectionId, Name = "FarmAccount", ValueJson = "{\"provider\":\"SecretManagement\",\"vault\":\"ContosoDemo\",\"name\":\"Windows/SharePoint/FarmAccount\"}", IsOverride = true, IsSecretReference = true }) ]; private static object[] DeploymentTargetAssignments() => [ Base(new DeploymentTargetAssignmentModel { Id = DeploymentTargetSp01Id, DeploymentGroupId = DeploymentBatchSharePointId, TargetId = VmSp01Id, RoleKey = "WebFrontEnd", SortOrder = 10, NodeDataJson = "{\"nodeName\":\"CT-SHP-01\"}" }), Base(new DeploymentTargetAssignmentModel { Id = DeploymentTargetSp02Id, DeploymentGroupId = DeploymentBatchSharePointId, TargetId = VmSp02Id, RoleKey = "Application", SortOrder = 20, NodeDataJson = "{\"nodeName\":\"CT-SHP-02\"}" }), Base(new DeploymentTargetAssignmentModel { Id = DeploymentTargetBgwSp01Id, DeploymentGroupId = DeploymentBatchBgwMergeId, TargetId = TargetBgwSp01Id, RoleKey = "Node", SortOrder = 10, NodeDataJson = "{\"nodeName\":\"CLD-SHP-01\",\"RunCentralAdministration\":true}" }), Base(new DeploymentTargetAssignmentModel { Id = DeploymentTargetBgwSp02Id, DeploymentGroupId = DeploymentBatchBgwMergeId, TargetId = TargetBgwSp02Id, RoleKey = "Node", SortOrder = 20, NodeDataJson = "{\"nodeName\":\"CLD-SHP-02\",\"RunCentralAdministration\":false}" }), Base(new DeploymentTargetAssignmentModel { Id = DeploymentTargetBgwSp03Id, DeploymentGroupId = DeploymentBatchBgwMergeId, TargetId = TargetBgwSp03Id, RoleKey = "Node", SortOrder = 30, NodeDataJson = "{\"nodeName\":\"CLD-SHP-03\",\"RunCentralAdministration\":false}" }) ]; private static TemplateVersionModel TemplateVersion(Guid id, Guid templateId, string jsonData) { return Base(new TemplateVersionModel { Id = id, TemplateId = templateId, Version = "1.0.0", JsonData = jsonData, JsonHash = TemplateVersionModel.ComputeSha256(jsonData), SchemaVersion = "1.0", IsPublished = true, PublishedAt = Timestamp, PublishedBy = Owner }); } private static T Base(T model) where T : BaseModel { model.Created = Timestamp; model.Modified = Timestamp; model.CreatedBy = Owner; model.ModifiedBy = Owner; return model; } private static T Junction(T model) where T : BaseJunctionModel { model.Created = Timestamp; model.Modified = Timestamp; model.CreatedBy = Owner; model.ModifiedBy = Owner; return model; } private const string ActiveDirectoryTemplateJson = """ { "schemaVersion": "1.0", "templateType": "Service", "parameters": { "DomainName": { "type": "string", "defaultValue": "corp.contoso.com" }, "NetBIOSName": { "type": "string", "defaultValue": "CONTOSO" } }, "variables": { "DefaultSiteName": "[concat(parameters('DomainName'), '-DefaultSite')]" }, "resources": { "AllNodes": [ { "NodeName": "*", "PSDscAllowPlainTextPassword": true } ], "NonNodeData": { "Services": { "ActiveDirectory": { "DomainName": "[parameters('DomainName')]", "NetBIOSName": "[parameters('NetBIOSName')]" } } } } } """; private const string SqlServerTemplateJson = """ { "schemaVersion": "1.0", "templateType": "Service", "parameters": { "InstanceName": { "type": "string", "defaultValue": "MSSQLSERVER" }, "DatabasePrefix": { "type": "string", "defaultValue": "Contoso" } }, "variables": { "ConfigDatabase": "[concat(parameters('DatabasePrefix'), '_Config')]" }, "resources": { "NonNodeData": { "Services": { "SqlServer": { "InstanceName": "[parameters('InstanceName')]", "ConfigDatabase": "[variables('ConfigDatabase')]" } } } } } """; private const string SharePointTemplateJson = """ { "schemaVersion": "1.0", "templateType": "Service", "parameters": { "DatabasePrefix": { "type": "string", "defaultValue": "SharePoint_Contoso_Test" }, "FarmAccount": { "type": "credential", "metadata": { "description": "Farm account resolved by the credential provider." } } }, "variables": { "ConfigDbName": "[concat(parameters('DatabasePrefix'), '_Farm_Config')]", "AdminContentDbName": "[concat(parameters('DatabasePrefix'), '_AdminContent')]" }, "resources": { "NonNodeData": { "Services": { "SharePoint": { "Farm": { "ConfigDatabase": "[variables('ConfigDbName')]", "AdminContentDatabase": "[variables('AdminContentDbName')]", "ManagedAccounts": { "FarmAccount": "[parameters('FarmAccount')]" } } } } } } } """; private const string TeamsTemplateJson = """ { "schemaVersion": "1.0", "templateType": "Service", "parameters": { "CallingPolicyName": { "type": "string", "defaultValue": "Contoso-Standard-Calling" }, "MeetingPolicyName": { "type": "string", "defaultValue": "Contoso-Standard-Meetings" } }, "variables": {}, "resources": { "NonNodeData": { "Services": { "Teams": { "CallingPolicy": "[parameters('CallingPolicyName')]", "MeetingPolicy": "[parameters('MeetingPolicyName')]" } } } } } """; } }