38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
|
using System;
|
|||
|
using System.Management.Automation;
|
|||
|
|
|||
|
namespace Alkami.Ops.Certificates
|
|||
|
{
|
|||
|
[Cmdlet("Import", "CertificatesToSecretServer")]
|
|||
|
[OutputType(typeof(string))]
|
|||
|
public class ImportCertificatesToSecretServer : Cmdlet
|
|||
|
{
|
|||
|
[Parameter(Position = 0, Mandatory = true)]
|
|||
|
public string SecretUsername;
|
|||
|
|
|||
|
[Parameter(Position = 1, Mandatory = true)]
|
|||
|
public string SecretPassword;
|
|||
|
|
|||
|
[Parameter(Position = 2, Mandatory = true)]
|
|||
|
public string[] Servers;
|
|||
|
|
|||
|
[Parameter(Position = 3, Mandatory = false)]
|
|||
|
public string SecretSite = "https://alkami.secretservercloud.com";
|
|||
|
|
|||
|
[Parameter(Position = 4, Mandatory = false)]
|
|||
|
public string FriendlySecretFolder = "ops.deployment-CertApi/FriendlyCertificates";
|
|||
|
|
|||
|
protected override void ProcessRecord()
|
|||
|
{
|
|||
|
var watch = new System.Diagnostics.Stopwatch();
|
|||
|
watch.Start();
|
|||
|
|
|||
|
using (var importer = new SecretServerImporter(SecretSite, SecretUsername, SecretPassword))
|
|||
|
{
|
|||
|
importer.Import(Servers, FriendlySecretFolder);
|
|||
|
}
|
|||
|
|
|||
|
Console.WriteLine($"Finished Importing secrets to SecretServer in {watch.Elapsed}");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|