- Added ApiClientModel and ApiTokenModel for managing API clients and tokens. - Introduced ConfigurationDefinitionModel and ConfigurationValueModel for configuration management. - Created CredentialSecretModel for storing credential secrets. - Developed DeploymentArtifactModel and DeploymentBatchModel for deployment management. - Enhanced DeploymentTargetModel and DeploymentTemplateSelectionModel to support template revisions. - Added TemplateRevisionModel and TemplateVersionModel for versioning templates. - Implemented ApiClientSecretHasher for secure secret hashing. - Created ApiTokenService for generating and validating JWT tokens. - Updated QueueJobService to handle deployment requests with artifacts. - Configured authentication settings in appsettings.json for JWT and Negotiate authentication.
69 lines
7.9 KiB
C#
69 lines
7.9 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
|
|
namespace Microsoft.SelfService.Portal.Core.API.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class SeedCredentialSecretsAndDeploymentArtifacts : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.InsertData(
|
|
table: "CredentialSecrets",
|
|
columns: new[] { "Id", "Created", "CreatedBy", "IsEnabled", "MetadataJson", "Modified", "ModifiedBy", "Name", "SecretType", "SecretValue", "UserName" },
|
|
values: new object[,]
|
|
{
|
|
{ new Guid("90000000-0000-0000-0000-000000000001"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", true, "{\"environment\":\"Demo\",\"plaintext\":true}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Windows/SharePoint/SetupAccount", "Credential", "DemoOnly-DoNotUseInProduction!", "CONTOSO\\svc_sp_setup" },
|
|
{ new Guid("90000000-0000-0000-0000-000000000002"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", true, "{\"environment\":\"Demo\",\"plaintext\":true}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Windows/SharePoint/FarmAccount", "Credential", "DemoOnly-DoNotUseInProduction!", "CONTOSO\\svc_sp_farm" },
|
|
{ new Guid("90000000-0000-0000-0000-000000000003"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", true, "{\"environment\":\"Demo\",\"plaintext\":true}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Windows/SharePoint/FarmPassphrase", "Secret", "DemoOnly-DoNotUseInProduction!", null },
|
|
{ new Guid("90000000-0000-0000-0000-000000000004"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", true, "{\"environment\":\"Demo\",\"plaintext\":true}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Windows/SharePoint/DefaultServiceAccount", "Credential", "DemoOnly-DoNotUseInProduction!", "CONTOSO\\svc_sp_service" },
|
|
{ new Guid("90000000-0000-0000-0000-000000000005"), new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", true, "{\"environment\":\"Demo\",\"plaintext\":true}", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "Windows/SharePoint/SearchAccount", "Credential", "DemoOnly-DoNotUseInProduction!", "CONTOSO\\svc_sp_search" }
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "DeploymentArtifacts",
|
|
columns: new[] { "Id", "ArtifactType", "Created", "CreatedBy", "DeploymentGroupId", "DeploymentJson", "DeploymentTargetId", "InputHash", "IsStale", "Modified", "ModifiedBy", "OutputHash", "ResolvedJson", "SourceJson", "SourceSnapshotJson", "StaleReasonJson", "Status", "TargetId" },
|
|
values: new object[] { new Guid("85000000-0000-0000-0000-000000000101"), "ResolvedConfigurationData", new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", new Guid("80000000-0000-0000-0000-000000000101"), "{\n \"metadata\": {\n \"name\": \"Contoso-Test-SharePoint\",\n \"deploymentId\": \"8f6c2c1a\",\n \"source\": \"DemoData\"\n },\n \"parameters\": {\n \"DatabasePrefix\": \"SharePoint_Contoso_Test\"\n },\n \"variables\": {\n \"DatabasePrefix\": \"SharePoint_Contoso_Test\",\n \"ServiceDbPrefix\": \"SharePoint_Contoso_Test_Services\",\n \"ConfigDbName\": \"SharePoint_Contoso_Test_Farm_Config\"\n },\n \"resources\": {\n \"AllNodes\": [\n { \"NodeName\": \"CLD-SHP-01\", \"RunCentralAdministration\": true },\n { \"NodeName\": \"CLD-SHP-02\", \"RunCentralAdministration\": false },\n { \"NodeName\": \"CLD-SHP-03\", \"RunCentralAdministration\": false }\n ],\n \"NonNodeData\": {\n \"LocalConfigurationManager\": {\n \"ConfigurationMode\": \"ApplyOnly\"\n }\n }\n }\n}", null, "F081B9BACB21534D9673317615B990CC3836D68416CD6C94E06045E524640020", false, new DateTime(2026, 7, 7, 0, 0, 0, 0, DateTimeKind.Utc), "DemoSeed", "8A49E86D9D571FDE9FE243849A5399A73750798F165B0D9DCE1318B8561CEF01", "{\n \"metadata\": {\n \"name\": \"Contoso-Test-SharePoint\",\n \"deploymentId\": \"8f6c2c1a\",\n \"source\": \"DemoData\"\n },\n \"parameters\": {\n \"DatabasePrefix\": \"SharePoint_Contoso_Test\"\n },\n \"variables\": {\n \"DatabasePrefix\": \"SharePoint_Contoso_Test\",\n \"ServiceDbPrefix\": \"SharePoint_Contoso_Test_Services\",\n \"ConfigDbName\": \"SharePoint_Contoso_Test_Farm_Config\"\n },\n \"resources\": {\n \"AllNodes\": [\n { \"NodeName\": \"CLD-SHP-01\", \"RunCentralAdministration\": true },\n { \"NodeName\": \"CLD-SHP-02\", \"RunCentralAdministration\": false },\n { \"NodeName\": \"CLD-SHP-03\", \"RunCentralAdministration\": false }\n ],\n \"NonNodeData\": {\n \"LocalConfigurationManager\": {\n \"ConfigurationMode\": \"ApplyOnly\"\n }\n }\n }\n}", "{\"source\":\"DemoData\",\"composition\":\"Test.Merge.ps1\"}", "{\n \"templateRevisions\": [\n {\n \"id\": \"72000000-0000-0000-0000-000000000101\",\n \"templateVersionId\": \"71000000-0000-0000-0000-000000000101\",\n \"role\": \"Environment\",\n \"alias\": \"Environment-Test\",\n \"hash\": \"58553C7A4E902B5E39D30272754FEF9EF805A7F36363D8316A9B37540C6D4646\"\n },\n {\n \"id\": \"72000000-0000-0000-0000-000000000102\",\n \"templateVersionId\": \"71000000-0000-0000-0000-000000000102\",\n \"role\": \"Domain\",\n \"alias\": \"Domain-Contoso\",\n \"hash\": \"B265C4D542826423BAAF50BF939F026CC67FF631FEC19F708067516BCE4C7667\"\n },\n {\n \"id\": \"72000000-0000-0000-0000-000000000103\",\n \"templateVersionId\": \"71000000-0000-0000-0000-000000000103\",\n \"role\": \"Service\",\n \"alias\": \"Service-SharePoint-Contoso\",\n \"hash\": \"E3B0E2A8E0C85CCD92AEA521ECD243E61E34C61D7078D6715E6317F5669A1D69\"\n },\n {\n \"id\": \"72000000-0000-0000-0000-000000000104\",\n \"templateVersionId\": \"71000000-0000-0000-0000-000000000104\",\n \"role\": \"Stage\",\n \"alias\": \"Stage-Install\",\n \"hash\": \"ACA23E44C9F625F080D2653646555A9DE5546D8DE7BB2166324E775BCF47F3C1\"\n }\n ],\n \"targets\": [\n { \"id\": \"30000000-0000-0000-0000-000000000101\", \"nodeName\": \"CLD-SHP-01\" },\n { \"id\": \"30000000-0000-0000-0000-000000000102\", \"nodeName\": \"CLD-SHP-02\" },\n { \"id\": \"30000000-0000-0000-0000-000000000103\", \"nodeName\": \"CLD-SHP-03\" }\n ]\n}", null, "Pending", null });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DeleteData(
|
|
table: "CredentialSecrets",
|
|
keyColumn: "Id",
|
|
keyValue: new Guid("90000000-0000-0000-0000-000000000001"));
|
|
|
|
migrationBuilder.DeleteData(
|
|
table: "CredentialSecrets",
|
|
keyColumn: "Id",
|
|
keyValue: new Guid("90000000-0000-0000-0000-000000000002"));
|
|
|
|
migrationBuilder.DeleteData(
|
|
table: "CredentialSecrets",
|
|
keyColumn: "Id",
|
|
keyValue: new Guid("90000000-0000-0000-0000-000000000003"));
|
|
|
|
migrationBuilder.DeleteData(
|
|
table: "CredentialSecrets",
|
|
keyColumn: "Id",
|
|
keyValue: new Guid("90000000-0000-0000-0000-000000000004"));
|
|
|
|
migrationBuilder.DeleteData(
|
|
table: "CredentialSecrets",
|
|
keyColumn: "Id",
|
|
keyValue: new Guid("90000000-0000-0000-0000-000000000005"));
|
|
|
|
migrationBuilder.DeleteData(
|
|
table: "DeploymentArtifacts",
|
|
keyColumn: "Id",
|
|
keyValue: new Guid("85000000-0000-0000-0000-000000000101"));
|
|
}
|
|
}
|
|
}
|